From 7af6dfc46f9a94e3966cdfa4e0d353e989eb9070 Mon Sep 17 00:00:00 2001 From: julian laplace Date: Wed, 10 May 2023 15:13:47 +0200 Subject: add stars and velocity --- src/relabi/canvas.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/relabi/canvas.js') diff --git a/src/relabi/canvas.js b/src/relabi/canvas.js index 62e5442..68f18c5 100644 --- a/src/relabi/canvas.js +++ b/src/relabi/canvas.js @@ -34,6 +34,8 @@ export default class RelabiCanvas { // Start drawing this.requestAnimationFrame(0); + + window.addEventListener("resize", () => this.resize()); } /** @@ -53,6 +55,9 @@ export default class RelabiCanvas { requestAnimationFrame((frame) => { this.requestAnimationFrame(frame); }); + if (this.relabi.paused) { + return; + } this.paint(frame); this.lastFrame = frame; } @@ -211,7 +216,7 @@ export default class RelabiCanvas { continue; } ctx.beginPath(); - ctx.arc(x, y, NOTE_RADIUS, 0, 2 * Math.PI); + ctx.arc(x - NOTE_RADIUS / 2, y, NOTE_RADIUS, 0, 2 * Math.PI); ctx.fillStyle = direction ? `rgba(255,96,128,${opacity})` : `rgba(128,255,96,${opacity})`; -- cgit v1.2.3-70-g09d2