fix: move pages animation to onMount

This commit is contained in:
2024-11-12 15:10:18 +01:00
parent d9708c5bfe
commit 54682c6886
7 changed files with 90 additions and 80 deletions

View File

@@ -3,6 +3,7 @@
<script lang="ts">
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
import { page, navigating } from '$app/stores'
import { onMount } from 'svelte'
import { scroll, stagger, timeline } from 'motion'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
@@ -144,6 +145,15 @@
})
// Destroy
return () => {
observerPhotos && observerPhotos.disconnect()
mutationPhotos && mutationPhotos.disconnect()
}
})
onMount(() => {
/**
* Animations
*/
@@ -192,13 +202,6 @@
// Run animation
requestAnimationFrame(animation.play)
// Destroy
return () => {
observerPhotos && observerPhotos.disconnect()
mutationPhotos && mutationPhotos.disconnect()
}
})
</script>