Tweaks to gradient rotation algorithm

This commit is contained in:
Adam Iannazzone 2024-04-23 18:53:03 -04:00
parent 12093d0551
commit 9515a8453e

View file

@ -6,7 +6,12 @@ reduceMotion();
function updateGradientAngle() { function updateGradientAngle() {
for (let i = 0; i < gradientSpinElems.length; i++) { for (let i = 0; i < gradientSpinElems.length; i++) {
gradientAngles[i] += Math.floor(Math.random() * 5) - 5; gradientAngles[i] += Math.floor(Math.random() * 6) - 2;
if (gradientAngles[i] > 360) {
gradientAngles[i] -= 360;
} else if (gradientAngles[i] < -360) {
gradientAngles[i] += 360;
}
gradientSpinElems[i].style.background = `linear-gradient(${gradientAngles[i]}deg, #1a9fff, 15%, #946beb)`; gradientSpinElems[i].style.background = `linear-gradient(${gradientAngles[i]}deg, #1a9fff, 15%, #946beb)`;
} }
} }