Skip to content

Commit dd5e975

Browse files
committed
fix: prevent content flash before GSAP intro animations
- Hide header-reveal, hero-line, hero-title words, hero-text and hero-actions via CSS visibility:hidden before JS runs - Restore visibility:visible in gsap.set() calls so GSAP owns the full lifecycle with no flash of unstyled content
1 parent 21c27ba commit dd5e975

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/components/Header.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const links = [
8686
const bottomBar = document.getElementById('bar-bottom')!;
8787
let isMenuOpen = false;
8888

89-
gsap.set('.header-reveal', { y: -40, opacity: 0 });
89+
gsap.set('.header-reveal', { y: -40, opacity: 0, visibility: 'visible' });
9090
gsap.set('.menu-item', { y: 20, opacity: 0 });
9191
gsap.to('.header-reveal', {
9292
y: 0,

src/components/Hero.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
import gsap from 'gsap';
4242
import { addHoverAnimation, DURATION, EASE, isMobile } from '../utils/animations';
4343

44-
gsap.set('.hero-line', { scaleY: 0 });
45-
gsap.set('.hero-title .word', { y: '100%', opacity: 0 });
46-
gsap.set(['.hero-text', '.hero-actions'], { opacity: 0, y: 32 });
44+
gsap.set('.hero-line', { scaleY: 0, visibility: 'visible' });
45+
gsap.set('.hero-title .word', { y: '100%', opacity: 0, visibility: 'visible' });
46+
gsap.set(['.hero-text', '.hero-actions'], { opacity: 0, y: 32, visibility: 'visible' });
4747

4848
if (isMobile) {
4949
gsap.timeline()

src/styles/global.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@
1515
linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
1616
background-size: 4rem 4rem;
1717
}
18+
19+
/* Hide elements that GSAP animates in on load — prevents flash before JS runs */
20+
.header-reveal,
21+
.hero-line,
22+
.hero-title .word,
23+
.hero-text,
24+
.hero-actions {
25+
visibility: hidden;
26+
}
1827
}

0 commit comments

Comments
 (0)