Smoother interruption (not perfect but, I mean, it's aaalrright)

This commit is contained in:
Ulysse Cura 2026-03-09 21:08:13 +01:00
parent 4711e76540
commit 6c9f9c1bcf
1 changed files with 13 additions and 4 deletions

View File

@ -91,15 +91,25 @@ async function sessionStartupAnimation()
all_default_elements.forEach((elem) => elem.style.animation = "opacity-fade-in 0.5s");
all_default_elements.forEach((elem) => elem.style.opacity = 1);
window.onkeydown = null;
}
function interruptStartingAnimation()
{
let author_elem = document.body.querySelector(".startup-animation-author");
author_elem.getAnimations().forEach((animation) => animation.finish());
author_elem.getAnimations().forEach((animation) => {
// Skip if fade-out
if(animation.animationName != "opacity-fade-out")
animation.finish();
});
let text_elem = document.body.querySelector(".startup-animation-text");
text_elem.getAnimations().forEach((animation) => animation.finish());
let text_elem = document.body.querySelectorAll(".startup-animation-char");
text_elem.forEach((char_elem) => char_elem.getAnimations().forEach((animation) => {
// No need to skip fade-out because it is handled by startup-animation-text
if(animation.currentTime < 2800)
animation.currentTime = 2800;
}));
if(sound.currentTime < 2.75)
{
@ -109,7 +119,6 @@ function interruptStartingAnimation()
window.onkeydown = () => {
interruptStartingAnimation();
window.onkeydown = null;
}
// Only start animation once per session