Created
July 3, 2015 21:31
-
-
Save anonymous/5beb571eb0f64a680444 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/cebobo
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body onload="init();"> | |
<script id="jsbin-javascript"> | |
<script> | |
var canvas, ctx; | |
function init() { | |
// This function is called after the page is loaded | |
// 1 - Get the canvas | |
canvas = document.getElementById('myCanvas'); | |
// 2 - Get the context | |
ctx=canvas.getContext('2d'); | |
// 3 - start the animation | |
startAnimation(); | |
} | |
var id; | |
function animationLoop(timeStamp) { | |
// 1 - Clear | |
ctx.clearRect(0, 0, canvas.width, canvas.height); | |
// 2 Draw | |
drawShapes(...); | |
// 3 Move | |
moveShapes(...) | |
// call again mainloop after XXX milliseconds | |
requestAnimationFrame(animationLoop); | |
} | |
function startAnimation() { | |
id = requestAnimationFrame(animationLoop); | |
} | |
<\/script> | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"><script> | |
var canvas, ctx; | |
function init() { | |
// This function is called after the page is loaded | |
// 1 - Get the canvas | |
canvas = document.getElementById('myCanvas'); | |
// 2 - Get the context | |
ctx=canvas.getContext('2d'); | |
// 3 - start the animation | |
startAnimation(); | |
} | |
var id; | |
function animationLoop(timeStamp) { | |
// 1 - Clear | |
ctx.clearRect(0, 0, canvas.width, canvas.height); | |
// 2 Draw | |
drawShapes(...); | |
// 3 Move | |
moveShapes(...) | |
// call again mainloop after XXX milliseconds | |
requestAnimationFrame(animationLoop); | |
} | |
function startAnimation() { | |
id = requestAnimationFrame(animationLoop); | |
} | |
<\/script></script></body> | |
</html> |
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
<script> | |
var canvas, ctx; | |
function init() { | |
// This function is called after the page is loaded | |
// 1 - Get the canvas | |
canvas = document.getElementById('myCanvas'); | |
// 2 - Get the context | |
ctx=canvas.getContext('2d'); | |
// 3 - start the animation | |
startAnimation(); | |
} | |
var id; | |
function animationLoop(timeStamp) { | |
// 1 - Clear | |
ctx.clearRect(0, 0, canvas.width, canvas.height); | |
// 2 Draw | |
drawShapes(...); | |
// 3 Move | |
moveShapes(...) | |
// call again mainloop after XXX milliseconds | |
requestAnimationFrame(animationLoop); | |
} | |
function startAnimation() { | |
id = requestAnimationFrame(animationLoop); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment