Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "point-expand",
"title": "Point Expand",
"description": "Short statements land one at a time, ending 'Copy, paste, render.' with a pulsing accent period.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"files": [
{
"path": "registry/remocn/point-expand/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadInterTight } from \"@remotion/google-fonts/InterTight\";\nimport { useId } from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n interpolate,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\nconst inter = loadInterTight(\"normal\", {\n weights: [\"500\"],\n subsets: [\"latin\"],\n});\n\nexport interface PointExpandProps {\n statements?: string[];\n pulses?: number;\n accent?: string;\n speed?: number;\n theme?: \"dark\" | \"light\";\n}\n\nconst BEAM = [\"#f4f7ff\", \"#8fb4ff\", \"#3d5bff\", \"#1a1660\"] as const;\n\nconst PALETTES = {\n dark: { stage: \"#0A0A0B\", stageFg: \"#F4F3F0\", beamFg: \"#F7F8FF\" },\n light: { stage: \"#F5F4F0\", stageFg: \"#111113\", beamFg: \"#F7F8FF\" },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_EXPAND = Easing.bezier(0.7, 0, 0.25, 1);\nconst EASE_DROP = Easing.bezier(0.3, 1.35, 0.5, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst INTER_TIGHT_500 = [\n 223, 271, 452, 595, 601, 786, 608, 269, 324, 324, 479, 624, 274, 420, 260,\n 325, 604, 370, 571, 602, 611, 575, 589, 527, 588, 589, 260, 271, 624, 624,\n 624, 483, 926, 657, 612, 693, 679, 561, 544, 707, 699, 227, 509, 623, 522,\n 858, 706, 726, 597, 727, 603, 601, 608, 695, 657, 940, 624, 643, 597, 324,\n 325, 324, 433, 418, 402, 529, 574, 528, 574, 543, 327, 575, 561, 207, 207,\n 514, 207, 843, 557, 560, 574, 574, 342, 493, 330, 553, 524, 783, 509, 524,\n 509, 396, 301, 396, 624,\n];\nconst KERN_PAIRS = [\n \"AC-35 AG-35 AO-35 AQ-35 AT-86 AV-76 AW-62 AY-74 Ac-8 Ad-8 Ae-8 Ag-8\",\n \"Ao-8 Aq-8 At-34 Av-68 Aw-68 Ay-68 CX-9 DA-35 DT-31 DV-36 DW-9 DX-19\",\n \"DY-37 D.-45 D,-45 FA-91 FJ-68 Fc-40 Fd-40 Fe-40 Fg-40 Fo-40 Fq-40\",\n \"Fu-34 Fv-34 Fy-34 Fz-34 F.-34 F,-40 GA-22 GT-30 GV-22 GX-9 GY-25 Gi34\",\n \"Gj34 J.-34 J,-34 KC-36 KG-36 KO-36 KQ-36 Kc-40 Kd-40 Ke-40 Kg-40 Ki34\",\n \"Ko-40 Kq-40 Ku-34 Kv-40 Kw-62 Ky-40 LA36 LC-28 LG-28 LO-28 LQ-28 LT-94\",\n \"LV-71 LW-14 LY-53 Lt-22 Lv-68 Ly-68 OA-35 OT-31 OV-36 OW-9 OX-19 OY-37\",\n \"O.-45 O,-45 PA-77 PJ-96 P.-34 P,-40 QA-35 QT-31 QV-36 QW-9 QX-19 QY-37\",\n \"Q.-45 Q,-45 RV-18 RY-26 TA-86 TC-31 TG-31 TJ-91 TO-31 TQ-31 TY16 Ta-74\",\n \"Tc-78 Td-78 Te-78 Tg-78 Tm-57 Tn-57 To-78 Tp-57 Tq-78 Tr-57 Ts-74\",\n \"Tu-74 Tv-62 Tw-62 Tx-51 Ty-62 Tz-45 T.-34 T,-34 U.-34 U,-34 VA-76\",\n \"VC-36 VG-36 VJ-96 VO-36 VQ-36 Va-54 Vc-55 Vd-55 Ve-55 Vg-55 Vo-55\",\n \"Vq-55 Vs-45 V.-96 V,-96 WA-62 WC-9 WG-9 WJ-62 WO-9 WQ-9 Wa-53 Wc-50\",\n \"Wd-50 We-50 Wg-50 Wm-34 Wn-34 Wo-50 Wp-34 Wq-50 Wr-34 Ws-34 W.-96\",\n \"W,-96 XC-19 XG-19 XO-19 XQ-19 Xc-28 Xd-28 Xe-28 Xg-28 Xo-28 Xq-28\",\n \"YA-74 YC-37 YG-37 YJ-34 YO-37 YQ-37 YT16 Ya-82 Yc-89 Yd-89 Ye-89 Yg-89\",\n \"Ym-40 Yn-40 Yo-89 Yp-40 Yq-89 Yr-40 Ys-68 Yu-40 Y.-45 Y,-45 ZC-34\",\n \"ZG-34 ZO-34 ZQ-34 aT-45 aV-51 aW-51 aY-82 av-20 ay-20 bA-34 bT-78\",\n \"bV-55 bW-50 bX-28 bY-96 bv-19 bw-17 bx-21 by-19 cA-34 cT-78 cV-55\",\n \"cW-50 cX-28 cY-96 cv-19 cw-17 cx-21 cy-19 eA-34 eT-78 eV-55 eW-50\",\n \"eX-28 eY-96 ev-19 ew-17 ex-21 ey-19 fA-34 fJ-62 fY8 fa-17 fc-21 fd-21\",\n \"fe-21 fg-21 fo-21 fq-21 fs-21 f.-57 f,-57 gT-51 hT-45 hV-51 hW-51\",\n \"hY-82 hv-20 hy-20 iV34 iW34 jV34 jW34 kT-57 kc-22 kd-22 ke-22 kg-22\",\n \"ko-22 kq-22 mT-45 mV-51 mW-51 mY-82 mv-20 my-20 nT-45 nV-51 nW-51\",\n \"nY-82 nv-20 ny-20 oA-34 oT-78 oV-55 oW-50 oX-28 oY-96 ov-19 ow-17\",\n \"ox-21 oy-19 pA-34 pT-78 pV-55 pW-50 pX-28 pY-96 pv-19 pw-17 px-21\",\n \"py-19 qT-51 rA-40 rJ-57 rT-57 rZ-34 rc-20 rd-20 re-20 rf31 rg-20 ro-20\",\n \"rq-20 rt31 rv17 rw8 rx17 ry17 r.-62 r,-62 sT-74 sV-45 sW-34 sY-74 tB11\",\n \"tD11 tE11 tF11 tH11 tI11 tK11 tL11 tM11 tN11 tP11 tR11 tT-34 tV-8 tW-8\",\n \"tY-13 tb11 th11 tk11 tl11 ts-9 uT-51 uY-57 vA-68 vJ-62 vT-34 vY-34\",\n \"va-16 vc-19 vd-19 ve-19 vg-19 vo-19 vq-19 v.-42 v,-42 wA-68 wJ-57\",\n \"wT-51 wZ-34 wc-17 wd-17 we-17 wg-17 wo-17 wq-17 w.-74 w,-74 xT-51\",\n \"xc-21 xd-21 xe-21 xg-21 xo-21 xq-21 yA-68 yJ-62 yT-34 yY-34 ya-16\",\n \"yc-19 yd-19 ye-19 yg-19 yo-19 yq-19 y.-42 y,-42 zT-34 zc-16 zd-16\",\n \"ze-16 zg-16 zo-16 zq-16 .T-34 .Y-45 ,T-34 ,Y-45\",\n].join(\" \");\nconst KERN = new Map<string, number>(\n KERN_PAIRS.split(\" \").map((t) => [t.slice(0, 2), Number(t.slice(2)) / 1000]),\n);\nconst TRACK = -0.02;\nconst ASC = 0.969;\nconst DESC = 0.241;\nconst LINE = 1.08;\nconst DOT = 0.15;\nconst DOT_GAP = 0.05;\n\nfunction textEm(text: string) {\n let w = 0;\n let prev = \"\";\n for (const ch of text) {\n const c = ch.charCodeAt(0);\n w += (c >= 32 && c <= 126 ? INTER_TIGHT_500[c - 32] : 580) / 1000 + TRACK;\n w += KERN.get(prev + ch) ?? 0;\n prev = ch;\n }\n return w;\n}\n\nfunction breakLines(text: string, maxEm: number) {\n const words = text.split(/\\s+/).filter(Boolean);\n const total = textEm(words.join(\" \")) + DOT_GAP + DOT;\n const count = Math.max(1, Math.ceil(total / maxEm));\n const greedy = (target: number) => {\n const lines: string[][] = [[]];\n for (const w of words) {\n const cur = lines[lines.length - 1];\n const next = [...cur, w].join(\" \");\n if (cur.length && textEm(next) + DOT_GAP + DOT > target) lines.push([w]);\n else cur.push(w);\n }\n return lines;\n };\n let target = total / count;\n let lines = greedy(target);\n while (lines.length > count && target < maxEm) {\n target = Math.min(maxEm, target * 1.04);\n lines = greedy(target);\n }\n return lines;\n}\n\nfunction Grain({ opacity }: { opacity: number }) {\n const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n return (\n <svg\n width=\"100%\"\n height=\"100%\"\n style={{ position: \"absolute\", inset: 0, opacity, pointerEvents: \"none\" }}\n aria-hidden\n >\n <filter id={id}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.9\"\n numOctaves={2}\n seed={3}\n stitchTiles=\"stitch\"\n />\n <feColorMatrix values=\"0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.9 0\" />\n </filter>\n <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n </svg>\n );\n}\n\nexport function PointExpand({\n statements = [\n \"Launch films used to take weeks.\",\n \"Now they take an afternoon.\",\n \"Copy, paste, render.\",\n ],\n pulses = 2,\n accent = \"#3B5BFD\",\n speed = 1,\n theme = \"dark\",\n}: PointExpandProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height } = useVideoConfig();\n const p = PALETTES[theme];\n const list = (statements.length ? statements : [\"\"]).slice(0, 5);\n const count = list.length;\n\n const portrait = height > width * 1.1;\n const s = portrait\n ? (width / 1280) * 1.5\n : Math.min(width / 1280, height / 720);\n const maxW = width * (portrait ? 0.84 : 0.78);\n const baseFs = (portrait ? 112 : 108) * s;\n\n const scenes = list.map((raw, k) => {\n const text = raw.trim().replace(/[.。]+$/, \"\");\n const cap = portrait ? 3 : 2;\n let fs = baseFs;\n let lines = breakLines(text, maxW / fs);\n for (let i = 0; i < 10 && lines.length > cap; i++) {\n fs *= 0.9;\n lines = breakLines(text, maxW / fs);\n }\n const lh = fs * LINE;\n const top = (height - lines.length * lh) / 2;\n const baseline = ((LINE - (ASC + DESC)) / 2 + ASC) * fs;\n const rows = lines.map((words, li) => {\n const t = words.join(\" \");\n const last = li === lines.length - 1;\n const w = (textEm(t) + (last ? DOT_GAP + DOT : 0)) * fs;\n return { words, left: (width - w) / 2, w, y: top + li * lh };\n });\n const lastRow = rows[rows.length - 1];\n const r = (DOT * fs) / 2;\n const point = {\n x: lastRow.left + lastRow.w - r,\n y: lastRow.y + baseline - r - fs * 0.002,\n r,\n };\n const beam = k % 2 === 1;\n return { text, fs, lh, rows, point, beam };\n });\n\n const RISE = 14;\n const STAGGER = 2;\n const HOLD = 6;\n const PULSE = 7;\n const EXPAND = 18;\n const starts: number[] = [];\n const expands: number[] = [];\n let t = 2;\n for (let k = 0; k < count; k++) {\n starts.push(t);\n const words = scenes[k].rows.reduce((m, r) => m + r.words.length, 0);\n const landed = t + RISE + (words - 1) * STAGGER;\n const expandAt = landed + HOLD + pulses * PULSE;\n expands.push(expandAt);\n t = expandAt + EXPAND * 0.5;\n }\n const radius = (k: number) => {\n if (k === 0) return Number.POSITIVE_INFINITY;\n const { point } = scenes[k - 1];\n const far = Math.max(\n Math.hypot(point.x, point.y),\n Math.hypot(width - point.x, point.y),\n Math.hypot(point.x, height - point.y),\n Math.hypot(width - point.x, height - point.y),\n );\n const e = interpolate(\n frame,\n [expands[k - 1], expands[k - 1] + EXPAND],\n [0, 1],\n {\n ...CLAMP,\n easing: EASE_EXPAND,\n },\n );\n if (e <= 0) return 0;\n return point.r + (far + 4 - point.r) * e;\n };\n\n const pointFill = (k: number) => {\n if (k === count - 1) return scenes[k].beam ? p.stage : accent;\n return scenes[k + 1].beam ? accent : p.stage;\n };\n\n return (\n <AbsoluteFill style={{ background: p.stage, overflow: \"hidden\" }}>\n {scenes.map((sc, k) => {\n const r = radius(k);\n if (r <= 0.5) return null;\n if (k + 1 < count && radius(k + 1) > Math.hypot(width, height) * 1.5)\n return null;\n const origin = k > 0 ? scenes[k - 1].point : null;\n const fg = sc.beam ? p.beamFg : p.stageFg;\n const sink =\n k + 1 < count\n ? interpolate(frame, [expands[k], expands[k] + EXPAND], [0, 1], {\n ...CLAMP,\n easing: EASE_EXPAND,\n })\n : 0;\n const settle = Math.max(\n 0,\n interpolate(frame, [starts[k] - 4, starts[k] + 40], [1, 0], {\n ...CLAMP,\n easing: EASE_OUT,\n }),\n );\n const ox = origin ? origin.x : width / 2;\n const oy = origin ? origin.y : height / 2;\n const ground = sc.beam\n ? [\n `radial-gradient(circle at ${ox}px ${oy}px, ${accent} 0%, color-mix(in oklab, ${BEAM[2]} 85%, ${accent}) ${(0.12 * width).toFixed(0)}px, ${BEAM[3]} ${(0.62 * width).toFixed(0)}px, #0b0a2e ${(1.1 * width).toFixed(0)}px)`,\n `radial-gradient(60% 60% at 50% 120%, color-mix(in oklab, ${BEAM[1]} 28%, transparent) 0%, transparent 70%)`,\n ].join(\", \")\n : origin\n ? `radial-gradient(circle at ${ox}px ${oy}px, color-mix(in oklab, ${accent} ${theme === \"dark\" ? 16 : 10}%, ${p.stage}) 0%, ${p.stage} ${(0.7 * width).toFixed(0)}px)`\n : p.stage;\n const words = sc.rows.reduce((m, row) => m + row.words.length, 0);\n const landed = starts[k] + RISE + (words - 1) * STAGGER;\n const drop = interpolate(frame, [landed - 6, landed + 4], [0, 1], {\n ...CLAMP,\n easing: EASE_DROP,\n });\n const last = k === count - 1;\n const nPulses = last ? 1 : pulses;\n const pulseStart = landed + HOLD;\n let pulseScale = 1;\n const rings: { r: number; o: number }[] = [];\n for (let i = 0; i < nPulses; i++) {\n const a = pulseStart + i * PULSE;\n const u = interpolate(frame, [a, a + PULSE], [0, 1], CLAMP);\n if (u > 0 && u < 1)\n pulseScale += Math.sin(u * Math.PI) * (last ? 0.18 : 0.38);\n const ru = interpolate(frame, [a + 1, a + 1 + PULSE * 2.2], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n if (ru > 0 && ru < 1)\n rings.push({ r: sc.point.r * (1.2 + 3.4 * ru), o: (1 - ru) * 0.7 });\n }\n const pre = last\n ? 1\n : 1 -\n 0.18 *\n Math.sin(\n interpolate(\n frame,\n [expands[k] - 4, expands[k] + 2],\n [0, 1],\n CLAMP,\n ) * Math.PI,\n );\n const dotScale = (0.55 + 0.45 * drop) * pulseScale * pre;\n const fill = pointFill(k);\n return (\n <div\n key={k}\n style={{\n position: \"absolute\",\n inset: 0,\n clipPath: Number.isFinite(r)\n ? `circle(${r.toFixed(2)}px at ${ox.toFixed(2)}px ${oy.toFixed(2)}px)`\n : undefined,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: ground,\n transform: `scale(${(1 + settle * 0.04).toFixed(4)})`,\n transformOrigin: `${ox}px ${oy}px`,\n }}\n />\n <Grain opacity={sc.beam ? 0.07 : theme === \"dark\" ? 0.05 : 0.035} />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `scale(${(1 - sink * 0.05 + settle * 0.02).toFixed(4)})`,\n transformOrigin: `${sc.point.x}px ${sc.point.y}px`,\n opacity: 1 - sink * 0.35,\n }}\n >\n {(() => {\n let wi = 0;\n return sc.rows.map((row, li) => (\n <div\n key={li}\n style={{\n position: \"absolute\",\n left: row.left,\n top: row.y,\n height: sc.lh,\n lineHeight: `${sc.lh}px`,\n fontFamily: inter.fontFamily,\n fontWeight: 500,\n fontSize: sc.fs,\n letterSpacing: `${TRACK}em`,\n color: fg,\n whiteSpace: \"nowrap\",\n display: \"flex\",\n fontVariantLigatures: \"none\",\n }}\n >\n {row.words.map((w, j) => {\n const idx = wi++;\n const u = interpolate(\n frame,\n [\n starts[k] + idx * STAGGER,\n starts[k] + idx * STAGGER + RISE,\n ],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n return (\n <span\n key={j}\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n height: sc.lh + sc.fs * 0.1,\n paddingRight: \"0.04em\",\n marginRight:\n j < row.words.length - 1\n ? `${(INTER_TIGHT_500[0] / 1000 + TRACK - 0.04).toFixed(3)}em`\n : \"-0.04em\",\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n transform: `translateY(${((1 - u) * 118).toFixed(2)}%)`,\n }}\n >\n {w}\n </span>\n </span>\n );\n })}\n </div>\n ));\n })()}\n <svg\n width={width}\n height={height}\n style={{ position: \"absolute\", inset: 0, overflow: \"visible\" }}\n aria-hidden\n >\n {rings.map((ring, i) => (\n <circle\n key={i}\n cx={sc.point.x}\n cy={sc.point.y}\n r={ring.r}\n fill=\"none\"\n stroke={fill}\n strokeWidth={Math.max(1, 1.6 * s)}\n opacity={ring.o}\n />\n ))}\n {drop > 0 ? (\n <circle\n cx={sc.point.x}\n cy={sc.point.y - (1 - drop) * sc.fs * 0.35}\n r={sc.point.r * dotScale}\n fill={fill}\n opacity={Math.min(1, drop * 2)}\n />\n ) : null}\n </svg>\n </div>\n </div>\n );\n })}\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/point-expand.tsx"
}
],
"type": "registry:component"
}