Setting the file. One moment. Scene · Music To Video · heygen-com/hyperframes · Skills DocsGsap Min
(opens in a new tab)
references/motion-primitives/text-wave-distort/scene.html
HTML·106 lines·3 KB
#7c3aed
;
11 --hg-violet-2: #a855f7;
12 --hg-cyan: #2afff0;
13 --hg-bg: #0a0a0f;
14 --hg-fg: #f5f5fa;
15 --hg-dim: #6b6b78;
16 }
17 * {
18 margin: 0;
19 padding: 0;
20 box-sizing: border-box;
21 }
22 .stage {
23 position: absolute;
24 inset: 0;
25 display: flex;
26 align-items: center;
27 justify-content: center;
28 }
29 .wave-hero {
30 font-family: "Playfair Display", serif;
31 font-style: italic;
32 font-weight: 900;
33 font-size: 280px;
34 letter-spacing: -0.02em;
35 white-space: nowrap;
36 text-shadow: 0 0 40px rgba(168, 85, 247, 0.5);
37 }
38 .wave-hero .char {
39 display: inline-block;
40 will-change: transform;
41 }
42 /* per-char solid colors marching across a violet→cyan ramp */
43 .wave-hero .char:nth-child(1) {
44 color: #7c3aed;
45 }
46 .wave-hero .char:nth-child(2) {
47 color: #a855f7;
48 }
49 .wave-hero .char:nth-child(3) {
50 color: #d946ef;
51 }
52 .wave-hero .char:nth-child(4) {
53 color: #ec4899;
54 }
55 .wave-hero .char:nth-child(5) {
56 color: #2afff0;
57 }
58 </style>
59 <div class="stage">
60 <div class="wave-hero" id="hero">
61 <span class="char">f</span><span class="char">l</span><span class="char">u</span
62 ><span class="char">i</span><span class="char">d</span>
63 </div>
64 </div>
65 <script>
66 window.__timelines = window.__timelines || {};
67 const tl = gsap.timeline({ paused: true });
68
69 // Explicit fromTo entry — safer than .from() in paused/seek mode
70 tl.fromTo(
71 "#hero .char",
72 { y: 60, opacity: 0 },
73 { y: 0, opacity: 1, stagger: 0.06, ease: "back.out(1.8)", duration: 0.5 },
74 0.1,
75 );
76
77 // Continuous wave: phase 0→4 cycles over 1.5s, amplitude envelope rise→settle
78 const state = { phase: 0 };
79 tl.to(
80 state,
81 {
82 phase: 4,
83 duration: 1.5,
84 ease: "none",
85 onUpdate: function () {
86 const chars = document.querySelectorAll("#hero .char");
87 const p = state.phase / 4;
88 let amp;
89 if (p < 0.35) amp = (p / 0.35) * 24;
90 else if (p < 0.7)
91 amp = 24 - ((p - 0.35) / 0.35) * 12; // 24 → 12
92 else amp = 12 - ((p - 0.7) / 0.3) * 4; // 12 → 8
93 chars.forEach((c, i) => {
94 const y = amp * Math.sin(state.phase * Math.PI * 2 + i * 0.45);
95 // Use gsap.set so it cooperates with GSAP's transform tracking
96 gsap.set(c, { y });
97 });
98 },
99 },
100 0.65,
101 );
102
103 window.__timelines["text-wave-distort"] = tl;
104 </script>
105 </div>
106</template>