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>

View File

@@ -3,7 +3,7 @@
<script lang="ts">
import { page, navigating } from '$app/stores'
import { goto } from '$app/navigation'
import { tick } from 'svelte'
import { onMount, tick } from 'svelte'
import { fade, scale } from 'svelte/transition'
import { quartOut } from 'svelte/easing'
import dayjs from 'dayjs'
@@ -216,7 +216,7 @@
}
$effect(() => {
onMount(() => {
/**
* Animations
*/