animations are now skippable yay

This commit is contained in:
Luna 2025-11-14 22:16:40 -03:00
parent 08d04f2667
commit 556e471281
3 changed files with 44 additions and 7 deletions

View file

@ -139,6 +139,16 @@ main {
position: fixed
}
.skip-animation {
animation: 4.5s 1 linear appear;
visibility: hidden;
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
}
.loading > p:first-child {
animation: 1s 1 linear appear;
animation-fill-mode: forwards;

26
assets/main.js Normal file
View file

@ -0,0 +1,26 @@
let stylesheet
window.addEventListener("load", () => {
stylesheet = document.styleSheets[0];
let skipNode = document.createElement("div");
skipNode.setAttribute("class", "skip-animation");
skipNode.setAttribute("onclick", "skipAnimation()");
document.body.appendChild(skipNode);
});
function skipAnimation() {
for (let node of document.getElementsByClassName("skip")) {
const animations = node.getAnimations();
for (let anim of animations) {
anim.finish();
}
}
for (let node of document.getElementsByClassName("splash")) {
const animations = node.getAnimations();
for (let anim of animations) {
anim.finish();
}
}
document.getElementsByClassName("skip-animation")[0].remove();
}