From bfe6a9cd8a1e1cdb08554354885086f70ed8b3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Wed, 16 Feb 2022 19:48:08 +0100 Subject: [PATCH] Fix Homepage transition --- src/routes/index.svelte | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 3203b36..77d3ea9 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -5,6 +5,7 @@ import type { AnimeTimelineInstance } from 'animejs' import { DELAY } from '$utils/contants' import { sleep } from '$utils/functions' + import { reveal, fade as animeFade } from '$animations/index' // Components import Metas from '$components/Metas.svelte' import PageTransition from '$components/PageTransition.svelte' @@ -25,19 +26,10 @@ const { settings, locations }: any = getContext('global') let scrollY: number, innerHeight: number - - - /** - * Transition: Anime timeline - */ let timeline: AnimeTimelineInstance - const transition = async () => { - requestAnimationFrame(() => timeline.play()) - } - - onMount(async () => { + onMount(() => { timeline = anime.timeline({ duration: 1600, easing: 'easeOutQuart', @@ -49,7 +41,7 @@ targets: '.homepage__headline', translateY: [16, 0], opacity: [0, 1], - }, 900) + }, 750) // Animate collage photos timeline.add({ @@ -63,8 +55,7 @@ delay: anime.stagger(75), }, 0) - await sleep(DELAY.PAGE_LOADING) - await transition() + sleep(DELAY.PAGE_LOADING).then(timeline.play) }) @@ -77,7 +68,14 @@ /> -
+