1
0
Fork 0
owenryan.us/assets/landingpage.ts

16 lines
550 B
TypeScript
Raw Normal View History

2023-05-16 03:59:18 +00:00
// JS Code that rotates the gradient on the content box on the front page
document.addEventListener("DOMContentLoaded", (): void => {
const mainBox: HTMLDivElement = document.querySelector("#rotating-gradient");
let angle: number = 0;
// Rotate the gradient 1 degree every 100ms
setInterval((): void => {
const gradient: string = `linear-gradient(${angle}deg, #1E1F46, #404040)`;
mainBox.style["background"] = gradient;
angle += 1;
if (angle >= 360) {
angle = 0
}
}, 100);
});