From cf1d0f5675c379fde863b2072b12624741c66f69 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Fri, 13 Oct 2023 14:16:58 +1100 Subject: [PATCH] Use callback --- src/app/page.tsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 0ae5042..963e1ff 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -48,18 +48,21 @@ export default function Home() { filter: "blur(10px)", duration: 0.2, ease: "in", + onComplete: () => { + setHitokoto(data.hitokoto); + setFromWho(data.from_who); + setFrom(data.from); + + timeline.to(motto.current, { + opacity: 1, + filter: "blur(0px)", + duration: 0.2, + ease: "out", + }) + } }); - setHitokoto(data.hitokoto); - setFromWho(data.from_who); - setFrom(data.from); - - timeline.to(motto.current, { - opacity: 1, - filter: "blur(0px)", - duration: 0.2, - ease: "out", - }) + } else { console.log("not updated") }