返回 html-video
index.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <title>Swiss Grid - Hyperframes</title>
7 <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
8 <style>
9 body,
10 html {
11 margin: 0;
12 padding: 0;
13 width: 1920px;
14 height: 1080px;
15 background-color: #f2f2f2;
16 overflow: hidden;
17 font-family: "Helvetica", Arial, sans-serif;
18 }
19
20 #master-root {
21 width: 1920px;
22 height: 1080px;
23 position: relative;
24 }
25
26 .background-grid {
27 position: absolute;
28 top: 0;
29 left: 0;
30 width: 100%;
31 height: 100%;
32 z-index: 0;
33 }
34
35 /* A-roll styling */
36 #short_mag_cut_frame {
37 position: absolute;
38 border-radius: 8px; /* Required */
39 z-index: 1;
40 box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
41 overflow: hidden;
42 background: #000;
43 }
44
45 #short_mag_cut,
46 #short_mag_cut_frame > img.__render_frame__,
47 #short_mag_cut_frame > img.__preview_render_frame__ {
48 position: absolute;
49 inset: 0;
50 width: 100%;
51 height: 100%;
52 object-fit: cover;
53 object-position: center;
54 display: block;
55 }
56
57 /* Overlay layers */
58 .overlay-layer {
59 position: absolute;
60 top: 0;
61 left: 0;
62 width: 100%;
63 height: 100%;
64 pointer-events: none;
65 }
66
67 #intro-comp {
68 z-index: 2;
69 }
70 #graphics-comp {
71 z-index: 3;
72 }
73 #captions-comp {
74 z-index: 4;
75 }
76 </style>
77 </head>
78 <body>
79 <div
80 id="master-root"
81 data-composition-id="master"
82 data-width="1920"
83 data-height="1080"
84 data-start="0"
85 data-duration="__VIDEO_DURATION__"
86 >
87 <!-- Background Grid -->
88 <img id="bg-grid" class="background-grid" src="assets/swiss-grid.svg" alt="Grid" />
89
90 <!-- Intro Sub-composition -->
91 <div
92 id="intro-comp"
93 class="overlay-layer"
94 data-composition-id="intro"
95 data-composition-src="compositions/intro.html"
96 data-start="0"
97 data-duration="1.86"
98 data-track-index="2"
99 ></div>
100
101 <!-- Graphics Sub-composition -->
102 <div
103 id="graphics-comp"
104 class="overlay-layer"
105 data-composition-id="graphics"
106 data-composition-src="compositions/graphics.html"
107 data-start="0"
108 data-duration="__VIDEO_DURATION__"
109 data-track-index="3"
110 ></div>
111
112 <!-- Captions Sub-composition -->
113 <div
114 id="captions-comp"
115 class="overlay-layer"
116 data-composition-id="captions"
117 data-composition-src="compositions/captions.html"
118 data-start="0"
119 data-duration="__VIDEO_DURATION__"
120 data-track-index="4"
121 ></div>
122
123 <script>
124 window.__timelines = window.__timelines || {};
125
126 const masterTL = gsap.timeline({ paused: true });
127 const v = document.getElementById("short_mag_cut_frame");
128
129 // --- A-ROLL MOVEMENT (Structured Swiss Layout) ---
130
131 // 1. Entrance (0-1.86s): Slide in from left, settle centered for Intro
132 masterTL.fromTo(
133 v,
134 { x: -1000, y: 120, width: 960, height: 840 },
135 { x: 480, y: 120, width: 960, height: 840, duration: 0.8, ease: "power2.out" },
136 0,
137 );
138
139 // 2. Stat 1 (1.86s - 4.68s): Move to right side (Graphic is on left)
140 masterTL.to(
141 v,
142 {
143 x: 1080,
144 y: 120,
145 width: 720,
146 height: 720,
147 duration: 0.25,
148 ease: "expo.out",
149 },
150 1.86,
151 );
152
153 // 3. Stat 2 (4.68s - 8.88s): Stay right, zoom in slightly
154 masterTL.to(
155 v,
156 {
157 x: 1080,
158 y: 60,
159 width: 780,
160 height: 780,
161 duration: 0.25,
162 ease: "expo.out",
163 },
164 4.68,
165 );
166
167 // 4. Stat 3 (8.88s - 14.2s): Move to left side (Graphic is on right)
168 masterTL.to(
169 v,
170 {
171 x: 120,
172 y: 120,
173 width: 720,
174 height: 720,
175 duration: 0.25,
176 ease: "expo.out",
177 },
178 8.88,
179 );
180
181 // 5. Conclusion (14.2s - 16.04s): Center large
182 masterTL.to(
183 v,
184 {
185 x: 240,
186 y: 60,
187 width: 1440,
188 height: 810,
189 duration: 0.5,
190 ease: "expo.out",
191 },
192 14.2,
193 );
194
195 window.__timelines["master"] = masterTL;
196 </script>
197 </div>
198
199 <!-- A-roll Video (direct child of body to avoid video_nested_in_timed_element) -->
200 <div id="short_mag_cut_frame">
201 <video
202 id="short_mag_cut"
203 src="__VIDEO_SRC__"
204 muted
205 playsinline
206 data-start="0"
207 data-duration="__VIDEO_DURATION__"
208 data-track-index="1"
209 ></video>
210 </div>
211 <audio
212 id="a-roll-audio"
213 src="__VIDEO_SRC__"
214 data-start="0"
215 data-duration="__VIDEO_DURATION__"
216 data-track-index="5"
217 data-volume="1"
218 ></audio>
219 </body>
220 </html>
221
221 lines HTML