返回 html-video
graphics.html
1 <template id="graphics-template">
2 <div data-composition-id="graphics" data-width="1920" data-height="1080" data-duration="15">
3 <div class="grid-container">
4 <!-- Stat 1: 47% -->
5 <div id="stat1" class="stat-group">
6 <div class="stat-value">47%</div>
7 <div class="stat-label">NEED MOTION GRAPHICS</div>
8 </div>
9
10 <!-- Stat 2: 62% -->
11 <div id="stat2" class="stat-group">
12 <div class="stat-value">62%</div>
13 <div class="stat-label">LOSING ATTENTION</div>
14 <div class="progress-container">
15 <div class="progress-bar"></div>
16 </div>
17 </div>
18
19 <!-- Stat 3: 3 OF 4 -->
20 <div id="stat3" class="stat-group">
21 <div class="stat-value">3 OF 4</div>
22 <div class="stat-label">LACK EDITING SKILLS</div>
23 <div class="grid-blocks">
24 <div class="block gold"></div>
25 <div class="block gold"></div>
26 <div class="block gold"></div>
27 <div class="block navy"></div>
28 </div>
29 </div>
30 </div>
31
32 <style>
33 [data-composition-id="graphics"] {
34 font-family: "Helvetica", Arial, sans-serif;
35 color: #0a1e3d;
36 background: transparent;
37 width: 1920px;
38 height: 1080px;
39 position: relative;
40 overflow: hidden;
41 }
42
43 [data-composition-id="graphics"] .grid-container {
44 display: grid;
45 grid-template-columns: repeat(12, 1fr);
46 grid-template-rows: repeat(12, 1fr);
47 width: 100%;
48 height: 100%;
49 padding: 80px;
50 gap: 20px;
51 }
52
53 [data-composition-id="graphics"] .stat-group {
54 opacity: 0;
55 display: flex;
56 flex-direction: column;
57 justify-content: flex-start;
58 align-items: flex-start;
59 background: #f2f2f2;
60 padding: 40px;
61 border-left: 10px solid #d4a017;
62 box-shadow: 20px 20px 0px rgba(10, 30, 61, 0.1);
63 }
64
65 /* Positioning Stats on Grid - Adjusted for A-roll structure */
66 [data-composition-id="graphics"] #stat1 {
67 grid-column: 2 / 6;
68 grid-row: 3 / 7;
69 }
70
71 [data-composition-id="graphics"] #stat2 {
72 grid-column: 2 / 6;
73 grid-row: 3 / 7;
74 }
75
76 [data-composition-id="graphics"] #stat3 {
77 grid-column: 7 / 12;
78 grid-row: 3 / 7;
79 }
80
81 [data-composition-id="graphics"] .stat-value {
82 font-size: 140px;
83 font-weight: 900;
84 color: #d4a017;
85 line-height: 0.8;
86 margin-bottom: 15px;
87 }
88
89 [data-composition-id="graphics"] .stat-label {
90 font-size: 24px;
91 font-weight: 300; /* Lighter weight */
92 color: #0a1e3d;
93 letter-spacing: 2px;
94 text-transform: uppercase;
95 }
96
97 /* Progress Bar for Stat 2 */
98 [data-composition-id="graphics"] .progress-container {
99 width: 100%;
100 height: 24px;
101 background: #e0e0e0;
102 margin-top: 30px;
103 border: 2px solid #0a1e3d;
104 position: relative;
105 }
106
107 [data-composition-id="graphics"] .progress-bar {
108 width: 0%;
109 height: 100%;
110 background: #d4a017;
111 }
112
113 /* Grid Blocks for Stat 3 */
114 [data-composition-id="graphics"] .grid-blocks {
115 display: flex;
116 gap: 20px;
117 margin-top: 30px;
118 }
119
120 [data-composition-id="graphics"] .block {
121 width: 80px;
122 height: 80px;
123 border: 3px solid #0a1e3d;
124 }
125
126 [data-composition-id="graphics"] .block.gold {
127 background: #d4a017;
128 }
129
130 [data-composition-id="graphics"] .block.navy {
131 background: #0a1e3d;
132 }
133 </style>
134
135 <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
136 <script>
137 (function () {
138 const tl = gsap.timeline({ paused: true });
139
140 // Timing Constants
141 const S1_START = 1.86;
142 const S1_END = 4.5;
143 const S2_START = 4.68;
144 const S2_END = 8.6;
145 const S3_START = 8.88;
146 const S3_END = 14.2;
147
148 const SLIDE_DUR = 0.25; // 250ms
149 const SHARP_EASE = "power2.out";
150
151 // Stat 1 Animation
152 tl.fromTo(
153 "#stat1",
154 { x: -200, opacity: 0 },
155 { x: 0, opacity: 1, duration: SLIDE_DUR, ease: SHARP_EASE },
156 S1_START,
157 );
158 tl.to(
159 "#stat1",
160 { x: 200, opacity: 0, duration: SLIDE_DUR, ease: "power2.in" },
161 S1_END - SLIDE_DUR,
162 );
163
164 // Stat 2 Animation
165 tl.fromTo(
166 "#stat2",
167 { y: 200, opacity: 0 },
168 { y: 0, opacity: 1, duration: SLIDE_DUR, ease: SHARP_EASE },
169 S2_START,
170 );
171 // Progress bar fill
172 tl.to(
173 "#stat2 .progress-bar",
174 { width: "62%", duration: S2_END - S2_START - SLIDE_DUR * 2, ease: "none" },
175 S2_START + SLIDE_DUR,
176 );
177 tl.to(
178 "#stat2",
179 { y: -200, opacity: 0, duration: SLIDE_DUR, ease: "power2.in" },
180 S2_END - SLIDE_DUR,
181 );
182
183 // Stat 3 Animation
184 tl.fromTo(
185 "#stat3",
186 { x: 200, opacity: 0 },
187 { x: 0, opacity: 1, duration: SLIDE_DUR, ease: SHARP_EASE },
188 S3_START,
189 );
190 // Stagger blocks
191 tl.from(
192 "#stat3 .block",
193 { scale: 0, duration: 0.3, stagger: 0.1, ease: "back.out(1.7)" },
194 S3_START + SLIDE_DUR,
195 );
196 tl.to(
197 "#stat3",
198 { x: -200, opacity: 0, duration: SLIDE_DUR, ease: "power2.in" },
199 S3_END - SLIDE_DUR,
200 );
201
202 window.__timelines = window.__timelines || {};
203 window.__timelines["graphics"] = tl;
204 })();
205 </script>
206 </div>
207 </template>
208
208 lines HTML