1var g = document.getElementById("canvas-gravity") 2var gtx = g.getContext("2d"); 3 4var simGoing = 0; 5function gravitySimulation(grav) { 6 if (simGoing == 0) { 7 simGoing = 1 8 var x = g.width/2- 15; 9 var y = 10; 10 var gravity = grav/5; 11 var vol = 0; 12 const update = setInterval(updateGravity, 30); 13 14 function updateGravity() { 15 gtx.fillStyle = "white" 16 gtx.fillRect(0, 0, g.width, g.height) 17 gtx.fillStyle = "red" 18 gtx.fillRect(x, y, 30, 20); 19 20 vol += gravity; 21 if (y+vol > g.height - 10) { 22 clearInterval(update) 23 gtx.fillStyle = "white" 24 gtx.fillRect(0, 0, g.width, g.height) 25 gtx.fillStyle = "red" 26 gtx.fillRect(x, g.height-20, 30, 20); 27 simGoing = 0; 28 } else { 29 y += vol; 30 } 31 } 32 } 33} 34 35let slideIndex = 1; 36showSlides(slideIndex); 37 38// Next/previous controls 39function plusSlides(n) { 40 showSlides(slideIndex += n); 41} 42 43// Thumbnail image controls 44function currentSlide(n) { 45 showSlides(slideIndex = n); 46} 47 48function showSlides(n) { 49 let i; 50 let slides = document.getElementsByClassName("mySlides"); 51 let dots = document.getElementsByClassName("dot"); 52 if (n > slides.length) {slideIndex = 1} 53 if (n < 1) {slideIndex = slides.length} 54 for (i = 0; i < slides.length; i++) { 55 slides[i].style.display = "none"; 56 } 57 for (i = 0; i < dots.length; i++) { 58 dots[i].className = dots[i].className.replace(" active", ""); 59 } 60 slides[slideIndex-1].style.display = "block"; 61 dots[slideIndex-1].className += " active"; 62}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.