AI Resource Pro / portrait-video · airesourcepro.com / src / scenes / IntroScene.tsx
| 1 | import React from "react"; |
| 2 | import { |
| 3 | AbsoluteFill, |
| 4 | Img, |
| 5 | OffthreadVideo, |
| 6 | interpolate, |
| 7 | spring, |
| 8 | staticFile, |
| 9 | useCurrentFrame, |
| 10 | useVideoConfig, |
| 11 | } from "remotion"; |
| 12 | import { fontFamily } from "../fonts"; |
| 13 | |
| 14 | export const IntroScene: React.FC<{ |
| 15 | date: string; |
| 16 | bgFile?: string; |
| 17 | }> = ({ date, bgFile }) => { |
| 18 | const frame = useCurrentFrame(); |
| 19 | const { fps, durationInFrames } = useVideoConfig(); |
| 20 | void durationInFrames; |
| 21 | void date; |
| 22 | |
| 23 | // Everything bounces in together, fast |
| 24 | const mainBounce = spring({ |
| 25 | frame, |
| 26 | fps, |
| 27 | config: { damping: 10, mass: 0.5, stiffness: 180 }, |
| 28 | }); |
| 29 | const mainScale = interpolate(mainBounce, [0, 1], [0.5, 1]); |
| 30 | |
| 31 | // Corner brackets |
| 32 | const bracketOpacity = interpolate(frame, [0, 10], [0, 0.15], { |
| 33 | extrapolateLeft: "clamp", |
| 34 | extrapolateRight: "clamp", |
| 35 | }); |
| 36 | const bracketColor = `rgba(67, 172, 233, ${bracketOpacity})`; |
| 37 | |
| 38 | const cornerBracketStyle = ( |
| 39 | top: boolean, |
| 40 | left: boolean |
| 41 | ): React.CSSProperties => ({ |
| 42 | position: "absolute", |
| 43 | top: top ? 60 : "auto", |
| 44 | bottom: top ? "auto" : 60, |
| 45 | left: left ? 60 : "auto", |
| 46 | right: left ? "auto" : 60, |
| 47 | width: 40, |
| 48 | height: 40, |
| 49 | borderTop: top ? `2px solid ${bracketColor}` : "none", |
| 50 | borderBottom: top ? "none" : `2px solid ${bracketColor}`, |
| 51 | borderLeft: left ? `2px solid ${bracketColor}` : "none", |
| 52 | borderRight: left ? "none" : `2px solid ${bracketColor}`, |
| 53 | }); |
| 54 | |
| 55 | return ( |
| 56 | <AbsoluteFill |
| 57 | style={{ |
| 58 | background: "#0d1117", |
| 59 | justifyContent: "center", |
| 60 | alignItems: "center", |
| 61 | }} |
| 62 | > |
| 63 | {/* Full-screen background video */} |
| 64 | {bgFile && ( |
| 65 | <OffthreadVideo |
| 66 | src={staticFile(bgFile)} |
| 67 | style={{ |
| 68 | position: "absolute", |
| 69 | width: "100%", |
| 70 | height: "100%", |
| 71 | objectFit: "cover", |
| 72 | }} |
| 73 | volume={0} |
| 74 | /> |
| 75 | )} |
| 76 | {bgFile && ( |
| 77 | <div |
| 78 | style={{ |
| 79 | position: "absolute", |
| 80 | inset: 0, |
| 81 | background: "rgba(0, 0, 0, 0.5)", |
| 82 | }} |
| 83 | /> |
| 84 | )} |
| 85 | |
| 86 | <div style={cornerBracketStyle(true, true)} /> |
| 87 | <div style={cornerBracketStyle(true, false)} /> |
| 88 | <div style={cornerBracketStyle(false, true)} /> |
| 89 | <div style={cornerBracketStyle(false, false)} /> |
| 90 | |
| 91 | {/* Everything bounces in as one unit */} |
| 92 | <div |
| 93 | style={{ |
| 94 | display: "flex", |
| 95 | flexDirection: "column", |
| 96 | alignItems: "center", |
| 97 | opacity: mainBounce, |
| 98 | transform: `scale(${mainScale})`, |
| 99 | }} |
| 100 | > |
| 101 | <Img |
| 102 | src={staticFile("logo.png")} |
| 103 | style={{ width: 240, height: 240, marginBottom: 36 }} |
| 104 | /> |
| 105 | |
| 106 | <div style={{ display: "flex", alignItems: "center", gap: 20 }}> |
| 107 | <span |
| 108 | style={{ |
| 109 | fontFamily, |
| 110 | fontWeight: 900, |
| 111 | fontSize: 84, |
| 112 | color: "#ffffff", |
| 113 | letterSpacing: "0.04em", |
| 114 | }} |
| 115 | > |
| 116 | AI Resource |
| 117 | </span> |
| 118 | <span |
| 119 | style={{ |
| 120 | fontFamily, |
| 121 | fontWeight: 800, |
| 122 | fontSize: 42, |
| 123 | color: "#ffffff", |
| 124 | backgroundColor: "#43ACE9", |
| 125 | padding: "8px 24px", |
| 126 | borderRadius: 50, |
| 127 | letterSpacing: "0.06em", |
| 128 | }} |
| 129 | > |
| 130 | PRO |
| 131 | </span> |
| 132 | </div> |
| 133 | |
| 134 | <div |
| 135 | style={{ |
| 136 | width: 260, |
| 137 | height: 3, |
| 138 | backgroundColor: "#43ACE9", |
| 139 | marginTop: 24, |
| 140 | marginBottom: 24, |
| 141 | }} |
| 142 | /> |
| 143 | |
| 144 | <div |
| 145 | style={{ |
| 146 | fontFamily, |
| 147 | fontWeight: 700, |
| 148 | fontSize: 72, |
| 149 | color: "#43ACE9", |
| 150 | letterSpacing: "0.4em", |
| 151 | }} |
| 152 | > |
| 153 | DAILY |
| 154 | </div> |
| 155 | |
| 156 | {/* date hidden */} |
| 157 | </div> |
| 158 | </AbsoluteFill> |
| 159 | ); |
| 160 | }; |