mirror of
https://github.com/stronk-dev/SignalRGB_Effects.git
synced 2026-04-20 13:25:10 +02:00
Fix gradientBall.html
bug could cause it to spin EXTREMELY quickly
This commit is contained in:
parent
02f6c978b1
commit
44aa8a136a
@ -74,7 +74,8 @@
|
|||||||
if (h == -1 || s == -1 || l == -1) {
|
if (h == -1 || s == -1 || l == -1) {
|
||||||
[h, s, l] = hexToHSL(fg);
|
[h, s, l] = hexToHSL(fg);
|
||||||
}
|
}
|
||||||
// Reset canvas
|
// Reset canvas transform and clear
|
||||||
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
ctx.fillStyle = bg;
|
ctx.fillStyle = bg;
|
||||||
ctx.fillRect(0, 0, width, height);
|
ctx.fillRect(0, 0, width, height);
|
||||||
|
|
||||||
@ -84,8 +85,8 @@
|
|||||||
y: (height / 2) - distance
|
y: (height / 2) - distance
|
||||||
};
|
};
|
||||||
|
|
||||||
// Increment rotation
|
// Increment rotation (wrap to avoid precision loss)
|
||||||
rotate += speed
|
rotate = (rotate + speed) % 6283.185
|
||||||
|
|
||||||
// Define gradient for ball
|
// Define gradient for ball
|
||||||
var grd = ctx.createRadialGradient(midPoint.x, midPoint.y, 0, midPoint.x, midPoint.y, radius);
|
var grd = ctx.createRadialGradient(midPoint.x, midPoint.y, 0, midPoint.x, midPoint.y, radius);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user