Fix the loading screen when `lib.init.layout`.

This commit is contained in:
Tipx-L 2023-10-25 09:17:46 -07:00
parent 00072acb39
commit eee7e72992
2 changed files with 31 additions and 12 deletions

View File

@ -11184,10 +11184,10 @@
} }
}, },
layout:function(layout,nosave){ layout:function(layout,nosave){
const previousTransitionDuration=document.documentElement.style.transitionDuration; const loadingScreen=ui.create.div('.loading-screen',document.body),loadingScreenStyle=loadingScreen.style;
document.documentElement.style.transitionDuration='1s'; loadingScreenStyle.animationDuration='1s';
const previousFilter=document.documentElement.style.filter,previousWebkitFilter=document.documentElement.style.webkitFilter; loadingScreenStyle.animationFillMode='forwards';
document.documentElement.style.filter=document.documentElement.style.webkitFilter='brightness(0)'; loadingScreenStyle.animationName='opacity-0-1';
if(layout=='default') layout='mobile'; if(layout=='default') layout='mobile';
if(!nosave) game.saveConfig('layout',layout); if(!nosave) game.saveConfig('layout',layout);
game.layout=layout; game.layout=layout;
@ -11298,14 +11298,8 @@
return new Promise(resolve=>setTimeout(resolve,500)); return new Promise(resolve=>setTimeout(resolve,500));
}).then(()=>{ }).then(()=>{
ui.updatec(); ui.updatec();
if(previousFilter) document.documentElement.style.filter=previousFilter; loadingScreenStyle.animationName='opacity-1-0';
else document.documentElement.style.removeProperty('filter'); loadingScreen.addEventListener('animationend',animationEvent=>animationEvent.target.remove());
if(previousWebkitFilter) document.documentElement.style.webkitFilter=previousWebkitFilter;
else document.documentElement.style.removeProperty('-webkit-filter');
return new Promise(resolve=>setTimeout(resolve,1000));
}).then(()=>{
if(previousTransitionDuration) document.documentElement.style.transitionDuration=previousTransitionDuration;
else document.documentElement.style.removeProperty('transition-duration');
}); });
}, },
background:function(){ background:function(){

View File

@ -5041,6 +5041,13 @@ div[data-decoration="bronze"]::after{
border-radius: 16px; border-radius: 16px;
} }
.loading-screen {
background-color: black;
height: 100%;
width: 100%;
z-index: 31415926;
}
/*--------动画--------*/ /*--------动画--------*/
@keyframes shadow_thunder { @keyframes shadow_thunder {
0% { 0% {
@ -5542,6 +5549,24 @@ div[data-decoration="bronze"]::after{
background-position: left center; background-position: left center;
} }
} }
@keyframes opacity-0-1 {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes opacity-1-0 {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
/*--------其它--------*/ /*--------其它--------*/
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; display: none;