From ee9ee662856be9b9cbdab0abe21d9f9f17c7700c Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Fri, 27 Feb 2026 15:44:37 +0100 Subject: [PATCH] Fix gradientLine.html bug could cause it to spin EXTREMELY quickly --- gradientLine.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gradientLine.html b/gradientLine.html index f899659..56ef43c 100644 --- a/gradientLine.html +++ b/gradientLine.html @@ -73,12 +73,13 @@ if (h == -1 || s == -1 || l == -1) { [h, s, l] = hexToHSL(fg); } - // Reset canvas + // Reset canvas transform and clear + ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.fillStyle = bg; ctx.fillRect(0, 0, width, height); - // Update rotation of line - rotate += speed; + // Update rotation of line (wrap to avoid precision loss) + rotate = (rotate + speed) % 6283.185; // Calculate useful anchor points startPoint = { @@ -123,4 +124,4 @@ window.requestAnimationFrame(update); } window.requestAnimationFrame(update); - \ No newline at end of file +