feat(loading): delay teaser slow-pulse animation by 1s after typewriter ends

This commit is contained in:
DESKTOP-I1T6TF3\Q
2026-06-04 14:58:57 +08:00
parent 5e1a4656ed
commit 1ac665ad88
+14 -1
View File
@@ -213,6 +213,19 @@ export function PlayCanvas({
waitForAudio: false,
});
const [pulseActive, setPulseActive] = useState(false);
useEffect(() => {
if (teaserDone) {
const timer = setTimeout(() => {
setPulseActive(true);
}, 1000);
return () => clearTimeout(timer);
} else {
setPulseActive(false);
}
}, [teaserDone]);
// ── Audio source change ──────────────────────────────────────────────
// Reset duration when audio source changes; if loading takes too long,
// unblock the typewriter via timeout so text doesn't stall.
@@ -505,7 +518,7 @@ export function PlayCanvas({
<span className="text-[9px] smallcaps text-clay-400 tracking-[0.2em] font-sans">
· · ·
</span>
<p className={`font-serif leading-[2] text-clay-700 text-[13px] md:text-[15px] italic whitespace-pre-wrap text-left w-full ${teaserDone ? "animate-slow-pulse" : ""}`}>
<p className={`font-serif leading-[2] text-clay-700 text-[13px] md:text-[15px] italic whitespace-pre-wrap text-left w-full ${pulseActive ? "animate-slow-pulse" : ""}`}>
{typedTeaser}
</p>
</div>