Last active
September 23, 2018 23:20
-
-
Save domenicrosati/0ac7b3ec565b371dcb2f2a0f66192ca4 to your computer and use it in GitHub Desktop.
getting started with animation
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
// jsfiddle.net | |
// functions | |
function drawBlueRectangle() { | |
ctx.fillStyle = "blue"; | |
ctx.fillRect(0, 0, 50, 50); | |
} | |
// another function | |
function drawBlueCircle() { | |
ctx.strokeStyle = "blue"; | |
ctx.beginPath(); | |
ctx.arc(95, 50, 40, 0, 2*Math.PI); | |
ctx.stroke(); | |
} | |
// functions with parameters | |
// functions | |
function drawRedRectangle(x, y) { | |
ctx.fillStyle = "red"; | |
ctx.fillRect(x, y, 50, 50); | |
} | |
// problems | |
// make the shape go down | |
// make the shape go the left | |
// how do we prevent the shape from going past the boundary? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment