-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.js
More file actions
108 lines (91 loc) · 3.85 KB
/
build.js
File metadata and controls
108 lines (91 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const fs = require('fs');
const path = 'src/components/HeroSection.tsx';
let data = fs.readFileSync(path, 'utf8');
const anchor1Target = " // Strict Scroll Scrubbing";
const anchor2Target = " }, { scope: sectionRef });";
const p1 = data.indexOf(anchor1Target);
const p2 = data.indexOf(anchor2Target);
if(p1 > -1 && p2 > -1) {
const chunk1 = data.substring(0, p1);
const chunk2 = data.substring(p2, data.length);
const replacement1 = ` // Split text animations dynamically over content behind it
if (textRef.current) {
gsap.to(".hero-title-upper", {
y: "-150%",
opacity: 0,
ease: "none",
scrollTrigger: {
trigger: sectionRef.current,
start: "top top",
end: "bottom top",
scrub: true,
}
});
// The bottom text goes DOWN
gsap.to(".hero-title-lower", {
y: "150%",
opacity: 0,
ease: "none",
scrollTrigger: {
trigger: sectionRef.current,
start: "top top",
end: "bottom top",
scrub: true,
}
});
// Scale and show middle layer
gsap.fromTo(".middle-3d-model", {
scale: 0.1,
y: "20vh",
opacity: 0,
}, {
scale: 1,
y: "-5vh",
opacity: 1,
ease: "none",
scrollTrigger: {
trigger: sectionRef.current,
start: "top top",
end: "bottom top",
scrub: true,
}
});
}
`;
data = chunk1 + replacement1 + chunk2;
} else { console.log('first anchor fail'); }
const anchor3Target = " {/* Massive Central Typography */}";
const anchor4Target = ' <div className="flex flex-col md:flex-row md:items-center justify-between gap-8 border-t border-border pt-8">';
const p3 = data.indexOf(anchor3Target);
const p4 = data.indexOf(anchor4Target);
if(p3 > -1 && p4 > -1) {
const chunk3 = data.substring(0, p3);
const chunk4 = data.substring(p4, data.length);
const replacement2 = ` {/* Massive Typography & 3D Split */}
<div className="md:col-span-9 relative border-border" style={{ minHeight: "400px" }}>
{/* Middle 3D Model Layer */}
<div className="middle-3d-model absolute top-[10%] left-1/2 -translate-x-1/2 w-[120%] h-[120%] max-w-[800px] aspect-video z-0 pointer-events-auto">
<div className="sketchfab-embed-wrapper w-full h-full rounded-2xl overflow-hidden mix-blend-screen bg-black/50">
<iframe
title="Star Wars - Delta 7 Jedi Starfighter"
frameBorder="0"
allowFullScreen={true}
allow="autoplay; fullscreen; xr-spatial-tracking"
src="https://sketchfab.com/models/053a14f9353a4f4aa6300fa0a398ffab/embed?autostart=1&transparent=1&ui_theme=dark"
className="w-full h-full"
></iframe>
</div>
</div>
<h1 className="font-display text-5xl sm:text-7xl md:text-[7rem] lg:text-[8rem] font-bold leading-[0.9] tracking-tighter mb-8 text-foreground uppercase relative z-10 pointer-events-none">
<div className="hero-title-upper relative">
<div className="overflow-hidden pb-2"><div className="hero-title-line drop-shadow-md pb-4 pt-1">Designing</div></div>
</div>
<div className="hero-title-lower relative mt-2 md:mt-4">
<div className="overflow-hidden pb-2"><div className="hero-title-line drop-shadow-md pb-4">The Future</div></div>
<div className="overflow-hidden"><div className="hero-title-line text-primary drop-shadow-md">With AI</div></div>
</div>
</h1>
`;
data = chunk3 + replacement2 + chunk4;
} else { console.log('second anchor fail'); }
fs.writeFileSync(path, data, 'utf8');