From 03ffcfbd283cb3bb71452991af82722413ca6863 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Fri, 27 Feb 2026 15:51:31 +0100 Subject: [PATCH] Update gradientLine.html Math.PI > magic number --- gradientLine.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradientLine.html b/gradientLine.html index 56ef43c..785335a 100644 --- a/gradientLine.html +++ b/gradientLine.html @@ -18,7 +18,7 @@ var ctx = c.getContext("2d"); var width = 320; var height = 200; - var rotate = 1; + var rotate = 0; var h = -1; var s = -1; var l = -1; @@ -78,8 +78,8 @@ ctx.fillStyle = bg; ctx.fillRect(0, 0, width, height); - // Update rotation of line (wrap to avoid precision loss) - rotate = (rotate + speed) % 6283.185; + // Update rotation of line (wrap at full revolution) + rotate = (rotate + speed * 0.001) % (2 * Math.PI); // Calculate useful anchor points startPoint = { @@ -114,7 +114,7 @@ // Draw rectangle ctx.beginPath(); ctx.translate(midPoint.x, startPoint.y); - ctx.rotate(0.001 * rotate); + ctx.rotate(rotate); ctx.translate(-midPoint.x, -startPoint.y); ctx.rect(startPoint.x, startPoint.y, distance, height); ctx.fillStyle = grd;