From c69c2a7e520ae976285823d77627d3ab0457ca33 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Tue, 21 May 2024 17:54:25 +0800 Subject: [PATCH] improved animation --- src/components/sections/IntroComponent.svelte | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/sections/IntroComponent.svelte b/src/components/sections/IntroComponent.svelte index 57eb979..2c313f2 100644 --- a/src/components/sections/IntroComponent.svelte +++ b/src/components/sections/IntroComponent.svelte @@ -88,6 +88,12 @@ async function animateGreeting(greeting: string) { for (let i = 0; i < greeting.length; i++) { greetingState = addCharacter(greetingState, greeting); + + if (i === greeting.length - 1) { + greetingPulse.classList.remove("animate-pulse"); + greetingPulse.classList.add("hidden"); + } + await sleep(roleInterval); } } @@ -95,10 +101,11 @@ // after window finish loading, call animateRoles() onMount(async () => { await sleep(800); - animateGreeting(greeting).then(() => { - greetingPulse.classList.remove("animate-pulse"); - greetingPulse.classList.add("hidden"); - }); + animateGreeting(greeting); + // .then(() => { + // greetingPulse.classList.remove("animate-pulse"); + // greetingPulse.classList.add("hidden"); + // }); await animateRoles(); });