Created
August 11, 2012 00:52
-
-
Save minitech/3319565 to your computer and use it in GitHub Desktop.
Ball bashing head against ceiling
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
// A failed attempt | |
function animate() { | |
g.clearRect(0, 0, 32, 32); | |
var t = (new Date().getTime() - start) / 1000; | |
var circlePosition = Math.min(1, Math.abs(Math.tan(t * Math.PI) / Math.PI)); | |
g.beginPath(); | |
g.arc(16 + Math.cos(circlePosition * Math.PI) * 8, 16 + Math.sin(circlePosition * Math.PI) * 8, 2.5, 0, Math.PI * 2); | |
g.fill(); | |
requestAnimationFrame(animate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment