fix: move pages animation to onMount
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
import { getContext } from 'svelte'
|
import { getContext, onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import { smoothScroll } from '$utils/stores'
|
import { smoothScroll } from '$utils/stores'
|
||||||
import { cartOpen } from '$utils/stores/shop'
|
import { cartOpen } from '$utils/stores/shop'
|
||||||
@@ -44,7 +44,14 @@
|
|||||||
navChooseEl.scrollLeft = offsetLeft
|
navChooseEl.scrollLeft = offsetLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Destroy
|
||||||
|
return () => {
|
||||||
|
navObserver && navObserver.disconnect()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
@@ -95,12 +102,6 @@
|
|||||||
|
|
||||||
// Run animation
|
// Run animation
|
||||||
requestAnimationFrame(animation.play)
|
requestAnimationFrame(animation.play)
|
||||||
|
|
||||||
|
|
||||||
// Destroy
|
|
||||||
return () => {
|
|
||||||
navObserver && navObserver.disconnect()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
|
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
|
||||||
import { page, navigating } from '$app/stores'
|
import { page, navigating } from '$app/stores'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
import { scroll, stagger, timeline } from 'motion'
|
import { scroll, stagger, timeline } from 'motion'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||||
@@ -144,6 +145,15 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Destroy
|
||||||
|
return () => {
|
||||||
|
observerPhotos && observerPhotos.disconnect()
|
||||||
|
mutationPhotos && mutationPhotos.disconnect()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
@@ -192,13 +202,6 @@
|
|||||||
|
|
||||||
// Run animation
|
// Run animation
|
||||||
requestAnimationFrame(animation.play)
|
requestAnimationFrame(animation.play)
|
||||||
|
|
||||||
|
|
||||||
// Destroy
|
|
||||||
return () => {
|
|
||||||
observerPhotos && observerPhotos.disconnect()
|
|
||||||
mutationPhotos && mutationPhotos.disconnect()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page, navigating } from '$app/stores'
|
import { page, navigating } from '$app/stores'
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { tick } from 'svelte'
|
import { onMount, tick } from 'svelte'
|
||||||
import { fade, scale } from 'svelte/transition'
|
import { fade, scale } from 'svelte/transition'
|
||||||
import { quartOut } from 'svelte/easing'
|
import { quartOut } from 'svelte/easing'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte'
|
import AboutGridPhoto from '$components/atoms/AboutGridPhoto.svelte'
|
||||||
import ProcessStep from '$components/molecules/ProcessStep/ProcessStep.svelte'
|
import ProcessStep from '$components/molecules/ProcessStep/ProcessStep.svelte'
|
||||||
import Banner from '$components/organisms/Banner/Banner.svelte'
|
import Banner from '$components/organisms/Banner/Banner.svelte'
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -43,66 +44,6 @@
|
|||||||
offset: ['start end', 'end start']
|
offset: ['start end', 'end start']
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* Animations
|
|
||||||
*/
|
|
||||||
const animation = timeline([
|
|
||||||
// Banner
|
|
||||||
['.banner picture', {
|
|
||||||
scale: [1.06, 1],
|
|
||||||
opacity: [0, 1],
|
|
||||||
z: 0,
|
|
||||||
}, {
|
|
||||||
at: 0.4,
|
|
||||||
duration: 2.4,
|
|
||||||
}],
|
|
||||||
['.banner h1', {
|
|
||||||
y: [32, 0],
|
|
||||||
opacity: [0, 1],
|
|
||||||
}, {
|
|
||||||
at: 0.5,
|
|
||||||
}],
|
|
||||||
['.banner__top > *', {
|
|
||||||
y: [-100, 0],
|
|
||||||
opacity: [0, 1],
|
|
||||||
}, {
|
|
||||||
at: 0.4,
|
|
||||||
delay: stagger(0.25),
|
|
||||||
}],
|
|
||||||
|
|
||||||
// Intro elements
|
|
||||||
['.about__introduction .container > *', {
|
|
||||||
y: ['20%', 0],
|
|
||||||
opacity: [0, 1],
|
|
||||||
z: 0,
|
|
||||||
}, {
|
|
||||||
at: 0.75,
|
|
||||||
delay: stagger(0.25),
|
|
||||||
}],
|
|
||||||
['.first-photo', {
|
|
||||||
y: ['10%', 0],
|
|
||||||
opacity: [0, 1],
|
|
||||||
z: 0,
|
|
||||||
}, {
|
|
||||||
at: 1.2,
|
|
||||||
}],
|
|
||||||
['.first-photo img', {
|
|
||||||
scale: [1.06, 1],
|
|
||||||
opacity: [0, 1],
|
|
||||||
z: 0,
|
|
||||||
}, {
|
|
||||||
at: 1.5,
|
|
||||||
duration: 2.4,
|
|
||||||
}],
|
|
||||||
], {
|
|
||||||
delay: $navigating ? DELAY.PAGE_LOADING / 1000 : 0,
|
|
||||||
defaultOptions: {
|
|
||||||
duration: 1.6,
|
|
||||||
easing: quartOut,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
animation.stop()
|
|
||||||
|
|
||||||
// Sections
|
// Sections
|
||||||
inView('[data-reveal]', ({ target }) => {
|
inView('[data-reveal]', ({ target }) => {
|
||||||
animate(target, {
|
animate(target, {
|
||||||
@@ -163,6 +104,69 @@
|
|||||||
}, {
|
}, {
|
||||||
amount: 0.35,
|
amount: 0.35,
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
/**
|
||||||
|
* Animations
|
||||||
|
*/
|
||||||
|
const animation = timeline([
|
||||||
|
// Banner
|
||||||
|
['.banner picture', {
|
||||||
|
scale: [1.06, 1],
|
||||||
|
opacity: [0, 1],
|
||||||
|
z: 0,
|
||||||
|
}, {
|
||||||
|
at: 0.4,
|
||||||
|
duration: 2.4,
|
||||||
|
}],
|
||||||
|
['.banner h1', {
|
||||||
|
y: [32, 0],
|
||||||
|
opacity: [0, 1],
|
||||||
|
}, {
|
||||||
|
at: 0.5,
|
||||||
|
}],
|
||||||
|
['.banner__top > *', {
|
||||||
|
y: [-100, 0],
|
||||||
|
opacity: [0, 1],
|
||||||
|
}, {
|
||||||
|
at: 0.4,
|
||||||
|
delay: stagger(0.25),
|
||||||
|
}],
|
||||||
|
|
||||||
|
// Intro elements
|
||||||
|
['.about__introduction .container > *', {
|
||||||
|
y: ['20%', 0],
|
||||||
|
opacity: [0, 1],
|
||||||
|
z: 0,
|
||||||
|
}, {
|
||||||
|
at: 0.75,
|
||||||
|
delay: stagger(0.25),
|
||||||
|
}],
|
||||||
|
['.first-photo', {
|
||||||
|
y: ['10%', 0],
|
||||||
|
opacity: [0, 1],
|
||||||
|
z: 0,
|
||||||
|
}, {
|
||||||
|
at: 1.2,
|
||||||
|
}],
|
||||||
|
['.first-photo img', {
|
||||||
|
scale: [1.06, 1],
|
||||||
|
opacity: [0, 1],
|
||||||
|
z: 0,
|
||||||
|
}, {
|
||||||
|
at: 1.5,
|
||||||
|
duration: 2.4,
|
||||||
|
}],
|
||||||
|
], {
|
||||||
|
delay: $navigating ? DELAY.PAGE_LOADING / 1000 : 0,
|
||||||
|
defaultOptions: {
|
||||||
|
duration: 1.6,
|
||||||
|
easing: quartOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
animation.stop()
|
||||||
|
|
||||||
// Run animation
|
// Run animation
|
||||||
requestAnimationFrame(animation.play)
|
requestAnimationFrame(animation.play)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
import { quartOut } from 'svelte/easing'
|
import { quartOut } from 'svelte/easing'
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
const { credit } = data
|
const { credit } = data
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
import { quartOut } from '$animations/easings'
|
import { quartOut } from '$animations/easings'
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
const latestIssue = $derived(data.issues[0])
|
const latestIssue = $derived(data.issues[0])
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
import { getContext } from 'svelte'
|
import { getContext, onMount } from 'svelte'
|
||||||
import { timeline, stagger } from 'motion'
|
import { timeline, stagger } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
import { smoothScroll } from '$utils/stores'
|
import { smoothScroll } from '$utils/stores'
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
let innerHeight = $state<number>()
|
let innerHeight = $state<number>()
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
onMount(() => {
|
||||||
/**
|
/**
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user