Setting the file. One moment.
Caption Skin · Hyperframes Creative · heygen-com/hyperframes · Skills Docs
ContentsBack to the top of the page 22.10
Narration
(opens in a new tab)
frame-presets/biennale-yellow/ caption-skin.html
HTML · 221 lines · 8 KB
15
--cap-ink · --cap-canvas · --cap-accent · --cap-accent-2 · --font-display ·
16 --font-body · --cap-band-top · --cap-band-height
17 Hooks (do not rename): .caption-group / .caption-word + states .is-active / .is-spoken,
18 root data-composition-id="captions", timeline at window.__timelines["captions"].
19 State changes use gsap.set({className}) (applied on the engine's frame-by-frame seek);
20 never tl.call() callbacks (seek does not fire them → wrong state on render).
21
22 Visual: a warm-parchment card on a single 1px hairline indigo-ink border — biennale's
23 ONLY border — square corners, NO shadow (biennale's depth is atmospheric, never cast).
24 Instrument Serif, sentence case, ink glyphs. Upcoming words sit in faint ink; the
25 current word gets a solar-yellow underprint (the brand's signature "sun as panel /
26 underprint", a hard square block, no blur) with ink reading on top; spoken words
27 settle to solid ink, underprint cleared.
28 -->
29 < script src = "https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js" ></ script >
30
31 <!-- captions.mjs injects the project's :root tokens here -->
32 < style data-brand-tokens ></ style >
33
34 < style >
35 #captions-root {
36 position : absolute ;
37 inset : 0 ;
38 pointer-events : none ;
39 }
40 .caption-layer {
41 position : absolute ;
42 inset : 0 ;
43 z-index : 20 ;
44 pointer-events : none ;
45 }
46 /* the keep-out band, from captionBand(H) — frame content stays above it */
47 .caption-stage {
48 position : absolute ;
49 left : 0 ;
50 right : 0 ;
51 top : var ( --cap-band-top , 900 px );
52 height : var ( --cap-band-height , 180 px );
53 display : flex ;
54 align-items : center ;
55 justify-content : center ;
56 }
57 .caption-group {
58 /* every group is absolutely stacked over the SAME band — exactly one shown at a
59 time via opacity. Must be absolute: in-flow groups would lay out side-by-side. */
60 position : absolute ;
61 inset : 0 ;
62 display : flex ;
63 align-items : center ;
64 justify-content : center ;
65 opacity : 0 ;
66 }
67
68 /* THE parchment card — single 1px hairline ink border (biennale's only border),
69 square corners, NO shadow */
70 .caption-pill {
71 max-width : 78 % ;
72 padding : 20 px 44 px 24 px ;
73 background : var ( --cap-canvas , #e9e5db );
74 border : 1 px solid var ( --cap-ink , #1b2566 );
75 border-radius : 0 ;
76 }
77 .caption-line {
78 display : flex ;
79 flex-wrap : wrap ;
80 justify-content : center ;
81 gap : 0.1 em 0.34 em ;
82 font-family : var ( --font-display , "Instrument Serif" ), Georgia , serif ;
83 font-weight : 400 ;
84 font-size : clamp ( 40 px , 4.4 vw , 58 px );
85 line-height : 1.16 ;
86 letter-spacing : -0.01 em ;
87 }
88
89 /* upcoming — faint indigo ink, no underprint */
90 .caption-word {
91 display : inline-block ;
92 padding : 0 0.06 em ;
93 color : color-mix ( in srgb , var ( --cap-ink , #1b2566 ) 42 % , var ( --cap-canvas , #e9e5db ));
94 }
95 /* current word — THE solar-yellow underprint (box-shadow spread = a hard square
96 block w/o layout shift; no blur), indigo ink reading on top */
97 .caption-word.is-active {
98 color : var ( --cap-ink , #1b2566 );
99 background : var ( --cap-accent , #f1ee2e );
100 box-shadow : 0 0 0 0.06 em var ( --cap-accent , #f1ee2e );
101 }
102 /* already spoken — solid indigo ink, underprint cleared */
103 .caption-word.is-spoken {
104 color : var ( --cap-ink , #1b2566 );
105 background : transparent ;
106 box-shadow : none ;
107 }
108
109 /* optional per-word accents (dormant until a word-classer tags them) */
110 /* brand / key term — Instrument Serif italic, biennale's only display inflection */
111 .caption-word.cap-brand {
112 font-style : italic ;
113 }
114 /* numerals / data — the mono voice, slightly recessed */
115 .caption-word.cap-num {
116 font-family : var ( --font-body , "JetBrains Mono" ), ui-monospace , monospace ;
117 color : color-mix ( in srgb , var ( --cap-ink , #1b2566 ) 72 % , var ( --cap-canvas , #e9e5db ));
118 }
119 /* emphasis — an ember-red hairline underline (the counter-temperature accent) */
120 .caption-word.cap-cta {
121 text-decoration : underline ;
122 text-decoration-thickness : 2 px ;
123 text-decoration-color : var ( --cap-accent-2 , #e26b4a );
124 text-underline-offset : 0.1 em ;
125 }
126
127 @media ( max-aspect-ratio : 9 / 16 ) {
128 .caption-pill {
129 max-width : 92 % ;
130 }
131 .caption-line {
132 font-size : clamp ( 34 px , 5.4 vw , 48 px );
133 }
134 }
135 </ style >
136
137 < div
138 id = "captions-root"
139 data-composition-id = "captions"
140 data-timeline-locked
141 data-start = "0"
142 data-duration = "0"
143 data-fps = "30"
144 data-width = "0"
145 data-height = "0"
146 >
147 < div class = "caption-layer" aria-hidden = "true" >
148 < div id = "caption-stage" class = "caption-stage" ></ div >
149 </ div >
150 </ div >
151
152 < script >
153 // captions.mjs injects the engine's scene-aware groups + real duration here.
154 var GROUPS = [];
155 var DURATION = 0 ;
156
157 ( function () {
158 var stage = document. getElementById ( "caption-stage" );
159
160 // build DOM: one .caption-group per group, .caption-word per word
161 GROUPS . forEach ( function ( group , g ) {
162 var groupEl = document. createElement ( "div" );
163 groupEl.className = "caption-group" ;
164 groupEl.id = "caption-group-" + g;
165 var pill = document. createElement ( "div" );
166 pill.className = "caption-pill" ;
167 var line = document. createElement ( "div" );
168 line.className = "caption-line" ;
169 (group.words || []). forEach ( function ( w , i ) {
170 var span = document. createElement ( "span" );
171 span.className = "caption-word" ;
172 span.id = "caption-word-" + g + "-" + i;
173 span.textContent = String (w.text);
174 line. appendChild (span);
175 });
176 pill. appendChild (line);
177 groupEl. appendChild (pill);
178 stage. appendChild (groupEl);
179 });
180
181 window.__timelines = window.__timelines || {};
182 var tl = gsap. timeline ({ paused: true });
183
184 GROUPS . forEach ( function ( group , g ) {
185 var groupEl = document. getElementById ( "caption-group-" + g);
186 var words = group.words || [];
187 var next = GROUPS [g + 1 ];
188 var isLast = g === GROUPS . length - 1 ;
189 var start = Math. max ( 0 , Number (group.start));
190 var end = isLast ? DURATION : Math. min ( Number (next.start), Number (group.end) + 0.3 );
191 if (end <= start) end = start + 0.01 ;
192
193 // group on/off — exactly one group visible at a time
194 tl. set (groupEl, { opacity: 1 }, start);
195 tl. set (groupEl, { opacity: 0 }, end);
196
197 // 3-state karaoke via className SETS — seek-safe (gsap.set applies on the
198 // engine's frame-by-frame seek; .call callbacks would NOT fire).
199 words. forEach ( function ( w , i ) {
200 var el = document. getElementById ( "caption-word-" + g + "-" + i);
201 var at = Math. max (start, Number (w.start));
202 tl. set (el, { className: "caption-word" }, start); // upcoming (also resets on reverse-seek)
203 tl. set (el, { className: "caption-word is-active" }, at); // current
204 tl. fromTo (el, { scale: 0.97 }, { scale: 1 , duration: 0.14 , ease: "power2.out" }, at);
205 if (i + 1 < words. length ) {
206 var nextAt = Math. max (start, Number (words[i + 1 ].start));
207 tl. set (el, { className: "caption-word is-spoken" }, nextAt); // demote when next activates
208 }
209 });
210 if (words. length ) {
211 var lastEl = document. getElementById ( "caption-word-" + g + "-" + (words. length - 1 ));
212 var lastSpoken = Math. min (end, Number (words[words. length - 1 ].end) + 0.1 );
213 tl. set (lastEl, { className: "caption-word is-spoken" }, lastSpoken);
214 }
215 });
216
217 // full-span anchor so the sub-comp timeline spans the whole video
218 tl. to ({}, { duration: DURATION }, 0 );
219 window.__timelines[ "captions" ] = tl;
220 })();
221 </ script >