返回 html-video
intro.html
1 <template id="intro-template">
2 <div data-composition-id="intro" data-width="1920" data-height="1080" data-duration="3">
3 <div class="container">
4 <div class="title-card">
5 <h1 class="title">Hyperframes</h1>
6 <p class="subtitle">Design simplified.</p>
7 </div>
8 </div>
9
10 <style>
11 /* Import a rounded humanist sans-serif font */
12 @import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600&display=swap");
13
14 [data-composition-id="intro"] .container {
15 width: 100%;
16 height: 100%;
17 display: flex;
18 justify-content: flex-start; /* Align to left for speaker card */
19 align-items: center;
20 padding-left: 5%;
21 font-family: "Outfit", sans-serif;
22 background: transparent;
23 }
24
25 [data-composition-id="intro"] .title-card {
26 background-color: #3b5e3a; /* Forest Green for contrast */
27 padding: 40px 60px;
28 border-radius: 30px;
29 box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
30 text-align: left;
31 opacity: 0;
32 transform: translateX(-100%); /* Start off-screen left */
33 }
34
35 [data-composition-id="intro"] .title {
36 font-size: 100px;
37 font-weight: 600;
38 color: #f5f0e0; /* Cream text on green card */
39 margin: 0;
40 line-height: 1.1;
41 letter-spacing: -2px;
42 }
43
44 [data-composition-id="intro"] .subtitle {
45 font-size: 50px;
46 font-weight: 400;
47 color: #cc8832; /* Ochre accent */
48 margin: 10px 0 0 0;
49 line-height: 1.2;
50 }
51 </style>
52
53 <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
54 <script>
55 (function () {
56 const tl = gsap.timeline({ paused: true });
57
58 // Animation: Speaker card slides in from the left
59 tl.to(
60 '[data-composition-id="intro"] .title-card',
61 {
62 opacity: 1,
63 x: 0,
64 duration: 0.8,
65 ease: "power2.out",
66 },
67 0.2,
68 );
69
70 // Exit: Slide off left at 1.8s (synced with 47% graphic)
71 tl.to(
72 '[data-composition-id="intro"] .title-card',
73 {
74 x: "-120%",
75 opacity: 0,
76 duration: 0.6,
77 ease: "power2.in",
78 },
79 1.8,
80 );
81
82 window.__timelines = window.__timelines || {};
83 window.__timelines["intro"] = tl;
84 })();
85 </script>
86 </div>
87 </template>
88
88 lines HTML