How to move a circle from the bottom of the page up every time you click a button.
I am having trouble trying to get a red circle to move up the page every time a user clicks a "Jump" button in my Game Development class using Java Script. I waas able to ge the canvas to show a current count each time the ""Jump" button is clicked but the red circle does not even show on the page. This is the code I am currently using: window.onload = function() { let btn = document.getElementById("jump"); let count = 0; btn.onclick = function() { count += 1; context.clearRect(0,0,600, 400); context.font = '25px Arial'; context.fillStyle = 'white'; context.fillText("Count: " + count, 20, 30); } var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var x = 300; var y = 350; function draw(){ context.beginPath(); context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill(); y -= 25; } btn.onclick(draw, 50); } This is the code example given to get the circle to move and to get the current count on the canvas: btn.onclick = function() { count += 1; //changing the y position y -= 25; //clearing the canvas context.clearRect(0, 0, 600, 400); //redrawing the circle context.beginPath(); context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill(); //drawing the count value context.font = '25px Arial'; context.fillStyle = 'white'; context.fillText("Count: " + count, 20, 30); } The steps they give for doing animation go as follows: 1. clear the canvas. 2. draw the objects in their new position. 3. update the positions based on the logic. 4. repeat the process. Can anyoine please let me know what I am doing or not doing in order to get the desired result? To recap, I am tasked with making a red ball or circle move from its current position a the bottom of the canvas, up on the y axis in incements of -25 everytime the user clicks the "Jump" button