Skip to content

Commit 59aa036

Browse files
committed
fix: guard growth visualizer animations
1 parent d18b377 commit 59aa036

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

site/src/components/visuals/GrowthVisualizer.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,24 @@ export function GrowthVisualizer() {
5959
() => {
6060
if (reduceMotion) return undefined
6161

62-
gsap.fromTo(
63-
'.visual-prototype__value',
64-
{ y: -4, autoAlpha: 0.55 },
65-
{ y: 0, autoAlpha: 1, duration: visualDuration, ease: visualEase, stagger: 0.04 },
66-
)
67-
gsap.fromTo(
68-
'.visual-prototype__slot',
69-
{ y: 6, scale: 0.94, autoAlpha: 0.55 },
70-
{ y: 0, scale: 1, autoAlpha: 1, duration: 0.34, ease: visualEase, stagger: 0.025 },
71-
)
62+
const root = rootRef.current
63+
const values = root ? Array.from(root.querySelectorAll('.visual-prototype__value')) : []
64+
const slots = root ? Array.from(root.querySelectorAll('.visual-prototype__slot')) : []
65+
66+
if (values.length > 0) {
67+
gsap.fromTo(
68+
values,
69+
{ y: -4, autoAlpha: 0.55 },
70+
{ y: 0, autoAlpha: 1, duration: visualDuration, ease: visualEase, stagger: 0.04 },
71+
)
72+
}
73+
if (slots.length > 0) {
74+
gsap.fromTo(
75+
slots,
76+
{ y: 6, scale: 0.94, autoAlpha: 0.55 },
77+
{ y: 0, scale: 1, autoAlpha: 1, duration: 0.34, ease: visualEase, stagger: 0.025 },
78+
)
79+
}
7280

7381
return undefined
7482
},

0 commit comments

Comments
 (0)