Skip to content

Instantly share code, notes, and snippets.

@rahji
Last active October 3, 2022 00:20
Show Gist options
  • Save rahji/49ec40aba93a89eb1f3604a9f7176b1a to your computer and use it in GitHub Desktop.
Save rahji/49ec40aba93a89eb1f3604a9f7176b1a to your computer and use it in GitHub Desktop.
ctx = Graphics.two()
let x = 0
onframe = function(timestamp) {
const w = Graphics.canvas.width, h = Graphics.canvas.height
ctx.strokeStyle = 'green'
ctx.clearRect( 0,0,w,h )
const size = 300
ctx.save()
ctx.setTransform(1,0,0,1,Math.random()*100+300,Math.random()*100+300)
ctx.rotate(x)
ctx.strokeRect( -size/2, -size/2, size, size)
ctx.restore()
x += .01
requestAnimationFrame( onframe )
}
onframe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment