Fix Homepage transition
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import type { AnimeTimelineInstance } from 'animejs'
|
import type { AnimeTimelineInstance } from 'animejs'
|
||||||
import { DELAY } from '$utils/contants'
|
import { DELAY } from '$utils/contants'
|
||||||
import { sleep } from '$utils/functions'
|
import { sleep } from '$utils/functions'
|
||||||
|
import { reveal, fade as animeFade } from '$animations/index'
|
||||||
// Components
|
// Components
|
||||||
import Metas from '$components/Metas.svelte'
|
import Metas from '$components/Metas.svelte'
|
||||||
import PageTransition from '$components/PageTransition.svelte'
|
import PageTransition from '$components/PageTransition.svelte'
|
||||||
@@ -25,19 +26,10 @@
|
|||||||
const { settings, locations }: any = getContext('global')
|
const { settings, locations }: any = getContext('global')
|
||||||
|
|
||||||
let scrollY: number, innerHeight: number
|
let scrollY: number, innerHeight: number
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transition: Anime timeline
|
|
||||||
*/
|
|
||||||
let timeline: AnimeTimelineInstance
|
let timeline: AnimeTimelineInstance
|
||||||
|
|
||||||
const transition = async () => {
|
|
||||||
requestAnimationFrame(() => timeline.play())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
onMount(async () => {
|
|
||||||
timeline = anime.timeline({
|
timeline = anime.timeline({
|
||||||
duration: 1600,
|
duration: 1600,
|
||||||
easing: 'easeOutQuart',
|
easing: 'easeOutQuart',
|
||||||
@@ -49,7 +41,7 @@
|
|||||||
targets: '.homepage__headline',
|
targets: '.homepage__headline',
|
||||||
translateY: [16, 0],
|
translateY: [16, 0],
|
||||||
opacity: [0, 1],
|
opacity: [0, 1],
|
||||||
}, 900)
|
}, 750)
|
||||||
|
|
||||||
// Animate collage photos
|
// Animate collage photos
|
||||||
timeline.add({
|
timeline.add({
|
||||||
@@ -63,8 +55,7 @@
|
|||||||
delay: anime.stagger(75),
|
delay: anime.stagger(75),
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
await sleep(DELAY.PAGE_LOADING)
|
sleep(DELAY.PAGE_LOADING).then(timeline.play)
|
||||||
await transition()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -77,7 +68,14 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<PageTransition name="homepage">
|
<PageTransition name="homepage">
|
||||||
<section class="homepage__intro">
|
<section class="homepage__intro"
|
||||||
|
use:reveal={{
|
||||||
|
animation: animeFade,
|
||||||
|
options: {
|
||||||
|
duration: 1000,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ScrollingTitle
|
<ScrollingTitle
|
||||||
tag="h1"
|
tag="h1"
|
||||||
class="homepage__title--houses"
|
class="homepage__title--houses"
|
||||||
|
|||||||
Reference in New Issue
Block a user