RetroDECK-Website/scripts/gradient.js

16 lines
471 B
JavaScript
Raw Normal View History

let gradientAngle = 45;
2024-04-18 16:22:51 +00:00
let gradientSpinElems = document.getElementsByClassName('gradient-spin');
const gradientInterval = setInterval(function() {
updateGradientAngle();
}, 50);
function updateGradientAngle() {
gradientAngle += 1
if (gradientAngle > 360) {
gradientAngle = 0;
}
2024-04-18 16:22:51 +00:00
for (let i=0; i<gradientSpinElems.length; i++) {
gradientSpinElems[i].style.background = `linear-gradient(${gradientAngle}deg, #1a9fff, #946beb)`;
}
}