mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
✨ feat: add fade up animation to post page, optimize global animation curves and durations, refine animation-related naming conventions
This commit is contained in:
parent
d4ea4c470b
commit
a35999629a
14 changed files with 122 additions and 52 deletions
18
src/components/Widgets/FadeUpAnimation.astro
Normal file
18
src/components/Widgets/FadeUpAnimation.astro
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script>
|
||||
function resetFadeUpAnimation() {
|
||||
document.querySelectorAll('.animation-fade-up').forEach((container) => {
|
||||
const childElements = Array.from(container.children).slice(0, 20)
|
||||
childElements.forEach(element =>
|
||||
(element as HTMLElement).style.animationName = 'none',
|
||||
)
|
||||
requestAnimationFrame(() => {
|
||||
childElements.forEach(element =>
|
||||
(element as HTMLElement).style.animationName = '',
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
resetFadeUpAnimation()
|
||||
document.addEventListener('astro:page-load', resetFadeUpAnimation)
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue