Created
April 9, 2023 18:36
-
-
Save ChickenChunk579/ecae83e30b6160571c2ceb52af347f71 to your computer and use it in GitHub Desktop.
dwitter experimenting
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
| function drawCube(ctx) { | |
| const size = 100; | |
| const center = size / 2; | |
| const angle = Date.now() / 1000; | |
| // Clear canvas | |
| ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); | |
| // Draw cube | |
| ctx.save(); | |
| ctx.translate(center, center); | |
| ctx.rotate(angle); | |
| ctx.beginPath(); | |
| ctx.moveTo(-center, -center); | |
| ctx.lineTo(center, -center); | |
| ctx.lineTo(center, center); | |
| ctx.lineTo(-center, center); | |
| ctx.closePath(); | |
| ctx.stroke(); | |
| ctx.restore(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment