()
| 70 | var playing = true; |
| 71 | var k = { ArrowUp: 0, ArrowDown: 0, ArrowLeft: 0, ArrowRight: 0 }; |
| 72 | function loop() { |
| 73 | speed -= (speed - (k.ArrowUp - k.ArrowDown)) * 0.05; |
| 74 | t += 5 * speed; |
| 75 | ctx.fillStyle = "#19f"; |
| 76 | ctx.fillRect(0, 0, c.width, c.height); |
| 77 | |
| 78 | ctx.fillStyle = "black"; |
| 79 | ctx.beginPath(); |
| 80 | ctx.moveTo(0, c.height); |
| 81 | for (let i = 5; i < c.width; i++) |
| 82 | ctx.lineTo(i, c.height - noise(t + i) * 0.25); |
| 83 | |
| 84 | ctx.lineTo(c.width, c.height); |
| 85 | ctx.fill(); |
| 86 | |
| 87 | player.draw(); |
| 88 | requestAnimationFrame(loop); |
| 89 | } |
| 90 | onkeydown = d => k[d.key] = 1; |
| 91 | onkeyup = d => k[d.key] = 0; |
| 92 | loop(); |
no test coverage detected