mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-14 15:54:13 +01:00
Add custom theme animation instead of transition view
This commit is contained in:
@@ -31,13 +31,14 @@ const navs = [
|
||||
]
|
||||
|
||||
function toggleTheme() {
|
||||
if (!document.startViewTransition) {
|
||||
document.body.style.animation = 'theme-switch-on .5s'
|
||||
setTimeout(() => {
|
||||
isDark.value = !isDark.value
|
||||
return
|
||||
}
|
||||
|
||||
document.startViewTransition(() => {
|
||||
})
|
||||
document.body.style.animation = 'theme-switch-off .5s'
|
||||
setTimeout(() => {
|
||||
document.body.style.animation = ''
|
||||
}, 500)
|
||||
}, 500)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -84,4 +85,26 @@ function toggleTheme() {
|
||||
.handwriting {
|
||||
font-family: 'Dancing Script', cursive;
|
||||
}
|
||||
|
||||
@keyframes theme-switch-on {
|
||||
0% {
|
||||
filter: blur(0);
|
||||
transform: scale(1);
|
||||
}
|
||||
100% {
|
||||
transform: scale(0.98);
|
||||
filter: blur(3px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes theme-switch-off {
|
||||
0% {
|
||||
transform: scale(0.98);
|
||||
filter: blur(3px);
|
||||
}
|
||||
100% {
|
||||
filter: blur(0);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user