返回 html-video
intro.html
1 <template id="intro-template">
2 <div data-composition-id="intro" data-width="1920" data-height="1080" data-duration="1.86">
3 <div class="container">
4 <div class="grid-line"></div>
5 <div class="text-wrapper">
6 <h1 class="title">HYPERFRAMES</h1>
7 <h2 class="subtitle">THE SURVEY FINDINGS</h2>
8 </div>
9 </div>
10
11 <style>
12 [data-composition-id="intro"] {
13 background-color: #f5f5f5; /* Off-white */
14 width: 1920px;
15 height: 1080px;
16 display: flex;
17 align-items: center;
18 justify-content: center;
19 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
20 overflow: hidden;
21 }
22
23 [data-composition-id="intro"] .container {
24 position: relative;
25 width: 100%;
26 height: 100%;
27 display: flex;
28 flex-direction: column;
29 justify-content: center;
30 padding-left: 160px; /* Swiss grid alignment */
31 }
32
33 [data-composition-id="intro"] .grid-line {
34 position: absolute;
35 left: 160px;
36 top: 50%;
37 width: 0px;
38 height: 12px;
39 background-color: #0a1e3d; /* Navy */
40 transform: translateY(-180px); /* Positioned above the text */
41 }
42
43 [data-composition-id="intro"] .text-wrapper {
44 display: flex;
45 flex-direction: column;
46 gap: 0;
47 overflow: hidden;
48 }
49
50 [data-composition-id="intro"] .title {
51 color: #0a1e3d;
52 font-size: 180px;
53 font-weight: 900; /* Black weight */
54 line-height: 0.9;
55 margin: 0;
56 letter-spacing: -0.04em;
57 text-transform: uppercase;
58 transform: translateX(-100%); /* Start off-screen left */
59 }
60
61 [data-composition-id="intro"] .subtitle {
62 color: #0a1e3d;
63 font-size: 64px;
64 font-weight: 300; /* Lighter weight for contrast */
65 line-height: 1.2;
66 margin: 0;
67 letter-spacing: 0.1em;
68 text-transform: uppercase;
69 transform: translateX(-100%); /* Start off-screen left */
70 margin-top: 20px;
71 }
72 </style>
73
74 <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
75 <script>
76 (function () {
77 const tl = gsap.timeline({ paused: true });
78
79 // Mechanical timing: 200ms (0.2s)
80 const MECHANICAL_DURATION = 0.2;
81 const STAGGER = 0.1;
82
83 // 1. Animate the grid line first
84 tl.to(
85 ".grid-line",
86 {
87 width: "1200px",
88 duration: 0.4,
89 ease: "power4.out",
90 },
91 0.2,
92 );
93
94 // 2. Slide in the title
95 tl.to(
96 ".title",
97 {
98 x: 0,
99 duration: MECHANICAL_DURATION,
100 ease: "power2.inOut",
101 },
102 0.5,
103 );
104
105 // 3. Slide in the subtitle with a slight stagger
106 tl.to(
107 ".subtitle",
108 {
109 x: 0,
110 duration: MECHANICAL_DURATION,
111 ease: "power2.inOut",
112 },
113 0.5 + STAGGER,
114 );
115
116 // 4. Subtle ambient motion (slow drift) to keep it alive
117 tl.to(
118 ".text-wrapper",
119 {
120 x: 30,
121 duration: 1.16, // Adjusted to fit 1.86s total
122 ease: "none",
123 },
124 0.7,
125 );
126
127 window.__timelines = window.__timelines || {};
128 window.__timelines["intro"] = tl;
129 })();
130 </script>
131 </div>
132 </template>
133
133 lines HTML