repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
auto generated repo
stars
latest
clone command
git clone gitlawb://did:key:z6MkeyXD...qbWG/cyber-834953git clone gitlawb://did:key:z6MkeyXD.../cyber-8349539d01a571auto generated project12h ago| #3 | <html> |
| #4 | <head> |
| #5 | <title>Mini Game</title> |
| #6 | <style> |
| #7 | body { |
| #8 | background: black; |
| #9 | color: white; |
| #10 | text-align: center; |
| #11 | } |
| #12 | canvas { |
| #13 | background: #222; |
| #14 | } |
| #15 | </style> |
| #16 | </head> |
| #17 | <body> |
| #18 |
| #19 | <h1>HTML5 Game</h1> |
| #20 |
| #21 | <canvas id="game" width="400" height="400"></canvas> |
| #22 |
| #23 | <script> |
| #24 | const canvas = document.getElementById("game"); |
| #25 | const ctx = canvas.getContext("2d"); |
| #26 |
| #27 | let x = 50; |
| #28 |
| #29 | function loop() { |
| #30 | ctx.clearRect(0,0,400,400); |
| #31 |
| #32 | ctx.fillStyle = "red"; |
| #33 | ctx.fillRect(x, 200, 50, 50); |
| #34 |
| #35 | x += 2; |
| #36 |
| #37 | if(x > 400) x = -50; |
| #38 |
| #39 | requestAnimationFrame(loop); |
| #40 | } |
| #41 |
| #42 | loop(); |
| #43 | </script> |
| #44 |
| #45 | </body> |
| #46 | </html> |
| #47 |