2024-04-18 16:22:51 +00:00
|
|
|
let gradientSpinElems = document.getElementsByClassName('gradient-spin');
|
2024-04-18 18:39:22 +00:00
|
|
|
let gradientAngles = Array.from({ length: gradientSpinElems.length }, () => Math.floor(Math.random() * 361) + 1);
|
|
|
|
let gradientInterval;
|
|
|
|
|
|
|
|
reduceMotion();
|
2024-04-18 14:52:32 +00:00
|
|
|
|
|
|
|
function updateGradientAngle() {
|
2024-04-18 18:39:22 +00:00
|
|
|
for (let i = 0; i < gradientSpinElems.length; i++) {
|
2024-04-23 22:53:03 +00:00
|
|
|
gradientAngles[i] += Math.floor(Math.random() * 6) - 2;
|
|
|
|
if (gradientAngles[i] > 360) {
|
|
|
|
gradientAngles[i] -= 360;
|
|
|
|
} else if (gradientAngles[i] < -360) {
|
|
|
|
gradientAngles[i] += 360;
|
|
|
|
}
|
2024-04-19 13:39:02 +00:00
|
|
|
gradientSpinElems[i].style.background = `linear-gradient(${gradientAngles[i]}deg, #1a9fff, 15%, #946beb)`;
|
2024-04-18 14:52:32 +00:00
|
|
|
}
|
2024-04-18 18:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function reduceMotion() {
|
|
|
|
let reduceMotionState = document.getElementById('reduce-motion-switch').checked;
|
|
|
|
if (reduceMotionState) {
|
|
|
|
clearInterval(gradientInterval);
|
2024-04-19 15:01:06 +00:00
|
|
|
// document.getElementById('screenshotCarousel').classList.remove('ride');
|
2024-04-18 18:39:22 +00:00
|
|
|
} else {
|
2024-04-19 15:01:06 +00:00
|
|
|
// document.getElementById('screenshotCarousel').classList.add('ride');
|
2024-04-18 18:39:22 +00:00
|
|
|
gradientInterval = setInterval(function () {
|
|
|
|
updateGradientAngle();
|
|
|
|
}, 100);
|
2024-04-18 14:52:32 +00:00
|
|
|
}
|
|
|
|
}
|