Created
December 6, 2019 10:02
-
-
Save CodeDraken/7c4e1f4d39e78eb3daf392113a344d32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // draws stuff to the screen | |
| // allows us to separate calculations and drawing | |
| function draw () { | |
| // clear the canvas and redraw everything | |
| ctx.clearRect(0, 0, canvas.width, canvas.height) | |
| // draw the ball (only object in this scene) | |
| ctx.beginPath() | |
| ctx.fillStyle = 'red' | |
| ctx.arc( | |
| ball.x, ball.y, | |
| ball.radius, | |
| 0, Math.PI * 2 | |
| ) | |
| ctx.fill() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment