Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: rebuild the studio bento on the editor's real controls
Richie McIlroy0ec4d17ffdf0
diff --git a/apps/web/components/pages/HomeTwo/studio/StudioFeatures.tsx b/apps/web/components/pages/HomeTwo/studio/StudioFeatures.tsxindex 91b48d8a6..4081c94a4 100644--- a/apps/web/components/pages/HomeTwo/studio/StudioFeatures.tsx+++ b/apps/web/components/pages/HomeTwo/studio/StudioFeatures.tsx@@ -1,37 +1,28 @@"use client";-import { classNames } from "@cap/utils/helpers";import { useRef } from "react";import { Eyebrow } from "../Eyebrow";import { Fit, LazyMount } from "../scenes/engine";-import {- BAND,- BODY_TEXT,- grainBg,- H_SECTION,- MODE_THEME,- meshStyle,-} from "../theme";+import { BAND, BODY_TEXT, grainBg, H_SECTION, MODE_THEME } from "../theme";import { useInView, useReducedMotion } from "../visibility";import { CARDS_A, CARDS_B } from "./catalog";import { CANVAS, type StudioCard } from "./shared";const ORDER = ["mask",- "text","scenes","zoom","captions",+ "text","three-d","canvas","grades","clips",];-const SPAN: Record<string, 1 | 2> = { mask: 2, scenes: 2, clips: 2 };const ALL = [...CARDS_A, ...CARDS_B];const CARDS = ORDER.flatMap((key) => {const card = ALL.find((item) => item.key === key);- return card ? [{ ...card, span: SPAN[key] ?? 1 }] : [];+ return card ? [card] : [];});const Card = ({ card }: { card: StudioCard }) => {@@ -41,35 +32,22 @@ const Card = ({ card }: { card: StudioCard }) => {return (<liref={ref}- className={classNames(- "flex flex-col rounded-[22px] p-3",- card.span === 2 ? "lg:col-span-2" : undefined,- )}+ className="flex flex-col rounded-[18px] p-1.5 shadow-[0_0_0_1px_rgba(17,17,17,0.05)] md:last:col-span-2 lg:last:col-span-1"style={grainBg(BAND)}>- <div className="rounded-[16px] p-2" style={meshStyle(MODE_THEME.studio)}>- <LazyMount- w={CANVAS.w}- h={CANVAS.h}- grow={card.span === 2}- className="mx-auto"- >- <Fit- w={CANVAS.w}- h={CANVAS.h}- grow={card.span === 2}- className="mx-auto"- >+ <div className="overflow-hidden rounded-[13px] shadow-[0_0_0_1px_rgba(17,17,17,0.06)]">+ <LazyMount w={CANVAS.w} h={CANVAS.h} grow>+ <Fit w={CANVAS.w} h={CANVAS.h} grow><card.Visual playing={inView && !reduced} /></Fit></LazyMount></div>- <div className="px-3 pb-3 pt-5">- <h3 className="text-[19px] font-normal leading-[1.15] tracking-[-0.02em] text-[#111111]">+ <div className="px-3.5 pb-3.5 pt-3.5">+ <h3 className="text-[17px] font-medium leading-[1.2] tracking-[-0.02em] text-[#111111]">{card.title}</h3><p- className={`${BODY_TEXT} mt-2 text-[14.5px] leading-[1.5] text-[rgba(17,17,17,0.72)]`}+ className={`${BODY_TEXT} mt-1.5 text-[14px] leading-[1.5] text-[rgba(17,17,17,0.68)]`}>{card.body}</p>@@ -81,17 +59,17 @@ const Card = ({ card }: { card: StudioCard }) => {export const StudioFeatures = () => (<section className="px-5 py-16 lg:py-24"><div className="mx-auto max-w-[1200px]">- <div className="mx-auto flex max-w-[760px] flex-col items-center text-center">+ <div className="mx-auto flex max-w-[720px] flex-col items-center text-center"><Eyebrow accent={MODE_THEME.studio.accent}>Studio Mode · The editor</Eyebrow><h2- className={`${H_SECTION} mt-6 text-balance text-[clamp(38px,5vw,56px)]`}+ className={`${H_SECTION} mt-6 text-balance text-[clamp(34px,4.4vw,48px)]`}>Polish it before anyone sees it</h2><p- className={`${BODY_TEXT} mt-6 max-w-[620px] text-balance text-[16.5px] leading-[1.5] text-[rgba(17,17,17,0.78)] sm:text-[17.5px]`}+ className={`${BODY_TEXT} mt-5 max-w-[560px] text-balance text-[16px] leading-[1.5] text-[rgba(17,17,17,0.78)] sm:text-[17px]`}>Studio Mode opens straight into an editor made for screen recordings.Blur what is private, switch scenes between screen and camera, add@@ -99,7 +77,7 @@ export const StudioFeatures = () => (</p></div>- <ul className="mt-14 grid gap-4 md:grid-cols-2 lg:grid-cols-3">+ <ul className="mt-10 grid gap-3 md:grid-cols-2 lg:grid-cols-3">{CARDS.map((card) => (<Card key={card.key} card={card} />))}diff --git a/apps/web/components/pages/HomeTwo/studio/cards/canvas.tsx b/apps/web/components/pages/HomeTwo/studio/cards/canvas.tsxnew file mode 100644index 000000000..ec82e7099--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/canvas.tsx@@ -0,0 +1,433 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import Image from "next/image";+import { useRef } from "react";+import { useCursor, useSceneState, type Way } from "../../scenes/engine";+import {+ Chip,+ ED,+ EditorButton,+ Ground,+ Panel,+ RecordedWindow,+ Segmented,+ Slider,+ useLoop,+} from "../shared";++/* Any canvas, one recording: the editor's real Background section along+ * the bottom (source pill, wallpaper categories, the Cities row, Padding+ * and Corners) and the canvas result above it. The wallpaper appears only+ * as a swatch and as the picked background, never as scenery. */++const SOURCES = [+ "Desktop",+ "Wallpaper",+ "Image",+ "Color",+ "Gradient",+ "Animated",+] as const;+const CATEGORIES = ["macOS", "Dark", "Blue", "Cities", "Purple", "Orange"];+const CITIES = ["liverpool", "santorini", "miami", "monaco", "london", "rome"];+const GRADIENTS = [+ "linear-gradient(135deg, #FF7E5F 0%, #FEB47B 100%)",+ "linear-gradient(135deg, #667EEA 0%, #764BA2 100%)",+ "linear-gradient(135deg, #43CEA2 0%, #185A9D 100%)",+ "linear-gradient(135deg, #F857A6 0%, #FF5858 100%)",+ "linear-gradient(135deg, #1FA2FF 0%, #12D8FA 55%, #A6FFCB 100%)",+ "linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%)",+];++const WALL_FROM = 3;+const WALL_TO = 1;+const GRADIENT_TO = 1;++const DURATION = 10000;+const WALL_AT = 1400;+const GRADIENT_AT = 3600;+const SWATCH_AT = 4600;+const BROWSER_AT = 5800;+const MACBOOK_AT = 7600;+const UNFRAME_AT = 9400;++const S = 1.15;+const PANEL = { left: 12, top: 211, w: 500, pad: 12 } as const;+const ROW = { pill: 12, chips: 52, grid: 84 } as const;+const THUMB = { w: 34, h: 34, gap: 6 } as const;+const RESULT = { w: 336, h: 189, left: 114, top: 12 } as const;+const WIN_SCALE = 0.46;+const WIN = {+ left: Math.round((RESULT.w - 360 * WIN_SCALE) / 2),+ top: 46,+} as const;++const toCanvas = (x: number, y: number) => ({+ x: PANEL.left + x * S,+ y: PANEL.top + y * S,+});+const thumbCenter = (i: number) =>+ toCanvas(+ PANEL.pad + i * (THUMB.w + THUMB.gap) + THUMB.w / 2,+ ROW.grid + THUMB.h / 2,+ );+const pillCenter = (i: number) => {+ const inner = PANEL.w - PANEL.pad * 2 - 4;+ const item = (inner - 10) / 6;+ return toCanvas(PANEL.pad + 2 + item * (i + 0.5) + 2 * i, ROW.pill + 15);+};++const PATH: Way[] = [+ { t: 0, x: 380, y: 130 },+ { t: WALL_AT - 500, ...thumbCenter(WALL_TO) },+ { t: WALL_AT, ...thumbCenter(WALL_TO), click: true },+ { t: GRADIENT_AT - 600, ...pillCenter(4) },+ { t: GRADIENT_AT, ...pillCenter(4), click: true },+ { t: SWATCH_AT - 400, ...thumbCenter(GRADIENT_TO) },+ { t: SWATCH_AT, ...thumbCenter(GRADIENT_TO), click: true },+ { t: SWATCH_AT + 900, x: 470, y: 150 },+ { t: DURATION, x: 470, y: 150 },+];++type Frame = "none" | "browser" | "macbook";++const uiAt = (t: number) => {+ const source = t >= GRADIENT_AT ? "Gradient" : "Wallpaper";+ const wall = t >= WALL_AT ? WALL_TO : WALL_FROM;+ const gradient = t >= SWATCH_AT ? GRADIENT_TO : 0;+ const frame: Frame =+ t >= UNFRAME_AT+ ? "none"+ : t >= MACBOOK_AT+ ? "macbook"+ : t >= BROWSER_AT+ ? "browser"+ : "none";+ return { source, wall, gradient, frame };+};++const title = (city: string) => city.charAt(0).toUpperCase() + city.slice(1);++const MiniField = ({+ label,+ value,+ fill,+}: {+ label: string;+ value: string;+ fill: number;+}) => (+ <div className="flex h-[26px] items-center gap-2">+ <span+ className="w-[54px] shrink-0 text-[13px] font-normal"+ style={{ color: ED.text1 }}+ >+ {label}+ </span>+ <div className="min-w-0 flex-1">+ <Slider fill={fill} />+ </div>+ <span+ className="min-w-8 text-right text-[11px] tabular-nums"+ style={{ color: ED.text3 }}+ >+ {value}+ </span>+ </div>+);++const Swatch = ({+ selected,+ children,+}: {+ selected: boolean;+ children: React.ReactNode;+}) => (+ <span+ className={classNames(+ "relative block overflow-hidden rounded-md transition-shadow duration-200",+ selected && "ring-2 ring-offset-2",+ )}+ style={{+ width: THUMB.w,+ height: THUMB.h,+ ["--tw-ring-color" as string]: ED.accent,+ ["--tw-ring-offset-color" as string]: ED.card,+ }}+ >+ {children}+ </span>+);++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState(uiAt(0));+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 2400,+ tick: (t, seek) => {+ setUi(uiAt(t));+ cursor.tick(PATH, t, seek);+ },+ });++ const wallpaper = ui.source === "Wallpaper";+ const browser = ui.frame === "browser";+ const macbook = ui.frame === "macbook";+ const label =+ ui.frame === "browser"+ ? "Frame · Browser"+ : ui.frame === "macbook"+ ? "Frame · MacBook"+ : wallpaper+ ? `Wallpaper · ${title(CITIES[ui.wall] ?? "")}`+ : "Gradient";++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="light">+ <div+ className="absolute overflow-hidden rounded-[10px]"+ style={{+ left: RESULT.left,+ top: RESULT.top,+ width: RESULT.w,+ height: RESULT.h,+ boxShadow:+ "0 12px 32px -8px rgba(0,0,0,0.35), 0 0 0 0.5px rgba(0,0,0,0.12)",+ }}+ >+ {[WALL_FROM, WALL_TO].map((index) => (+ <Image+ key={CITIES[index]}+ src={`/backgrounds/${CITIES[index]}.webp`}+ alt=""+ fill+ sizes="336px"+ draggable={false}+ className="object-cover transition-opacity duration-700"+ style={{ opacity: wallpaper && ui.wall === index ? 1 : 0 }}+ />+ ))}+ <div+ className="absolute inset-0 transition-opacity duration-700"+ style={{+ background: GRADIENTS[ui.gradient],+ opacity: wallpaper ? 0 : 1,+ }}+ />++ <div+ className="absolute"+ style={{+ left: WIN.left,+ top: WIN.top,+ width: 360 * WIN_SCALE,+ height: 250 * WIN_SCALE,+ }}+ >+ <div+ className="absolute left-0 top-0"+ style={{+ width: 360,+ height: 250,+ transform: `scale(${WIN_SCALE})`,+ transformOrigin: "top left",+ }}+ >+ <div+ className="pointer-events-none absolute transition-[opacity,transform] duration-500"+ style={{+ left: -14,+ top: -14,+ right: -14,+ bottom: -14,+ borderRadius: 22,+ background:+ "linear-gradient(180deg, #2b2d33 0%, #101114 12%)",+ boxShadow:+ "inset 0 0 0 1px rgba(255,255,255,0.08), 0 30px 60px -30px rgba(9,12,20,0.7)",+ opacity: macbook ? 1 : 0,+ transform: macbook ? "scale(1)" : "scale(1.04)",+ }}+ />+ <div+ className="pointer-events-none absolute transition-opacity duration-500"+ style={{+ left: -48,+ right: -48,+ bottom: -26,+ height: 12,+ borderRadius: "0 0 14px 14px",+ background: "linear-gradient(180deg, #d7d9de, #9a9ea6)",+ boxShadow: "0 14px 30px -12px rgba(9,12,20,0.6)",+ opacity: macbook ? 1 : 0,+ }}+ />+ <div+ className="pointer-events-none absolute inset-x-0 flex items-center gap-2 px-3 transition-[opacity,transform] duration-500"+ style={{+ top: -34,+ height: 36,+ borderRadius: "10px 10px 0 0",+ background: "#f6f7f9",+ border: "1px solid rgba(0,0,0,0.08)",+ borderBottom: "none",+ opacity: browser ? 1 : 0,+ transform: browser ? "translateY(0)" : "translateY(10px)",+ }}+ >+ <span className="flex items-center gap-1.5">+ {["#FF5F57", "#FEBC2E", "#28C840"].map((color) => (+ <span+ key={color}+ className="size-[9px] rounded-full"+ style={{ background: color }}+ />+ ))}+ </span>+ <span+ className="ml-1 flex h-6 items-center rounded-t-md px-3 text-[10.5px] font-medium"+ style={{ background: "#ffffff", color: "#202020" }}+ >+ Dashboard+ </span>+ <span+ className="ml-auto flex h-5 w-[46%] items-center justify-center rounded-md text-[10px]"+ style={{+ background: "rgba(17,17,17,0.06)",+ color: "rgba(17,17,17,0.6)",+ }}+ >+ acme.com/dashboard+ </span>+ </div>+ <div+ className="absolute inset-0 overflow-hidden transition-[border-radius] duration-500"+ style={{+ borderRadius: 10,+ boxShadow: "0 24px 50px -20px rgba(9,12,20,0.6)",+ }}+ >+ <div+ className="absolute inset-x-0 transition-[top] duration-500"+ style={{ top: browser ? -40 : 0 }}+ >+ <RecordedWindow left={0} top={0} />+ </div>+ </div>+ </div>+ </div>+ </div>++ <div+ className="absolute z-20"+ style={{ left: RESULT.left + 10, top: RESULT.top + 6 }}+ >+ <Chip className="h-6">+ <span+ className="size-2 rounded-full"+ style={{ background: ED.accent }}+ />+ {label}+ </Chip>+ </div>++ <Panel+ className="z-30 gap-0"+ style={{+ left: PANEL.left,+ top: PANEL.top,+ width: PANEL.w,+ padding: PANEL.pad,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ <Segmented options={SOURCES} value={ui.source} />++ <div className="mt-2.5 flex h-6 items-center justify-between">+ {wallpaper ? (+ <div className="flex items-center gap-1">+ {CATEGORIES.map((category) => {+ const on = category === "Cities";+ return (+ <span+ key={category}+ className="flex h-6 items-center rounded-[7px] px-2.5 text-[12px] font-medium"+ style={{+ background: on ? ED.ctlHover : "transparent",+ color: on ? ED.text1 : ED.text2,+ }}+ >+ {category}+ </span>+ );+ })}+ </div>+ ) : (+ <>+ <span+ className="text-[12px] font-medium"+ style={{ color: ED.text2 }}+ >+ Presets+ </span>+ <EditorButton className="h-6 text-[12px]">+ Randomize+ </EditorButton>+ </>+ )}+ </div>++ <div className="mt-2 flex items-start gap-4">+ <div+ className="grid shrink-0 grid-cols-6"+ style={{ gap: THUMB.gap }}+ >+ {wallpaper+ ? CITIES.map((city, i) => (+ <Swatch key={city} selected={ui.wall === i}>+ <Image+ src={`/backgrounds/thumbs/${city}.webp`}+ alt=""+ width={THUMB.w}+ height={THUMB.h}+ draggable={false}+ className="h-full w-full object-cover"+ />+ </Swatch>+ ))+ : GRADIENTS.map((gradient, i) => (+ <Swatch key={gradient} selected={ui.gradient === i}>+ <span+ className="block h-full w-full"+ style={{ background: gradient }}+ />+ </Swatch>+ ))}+ </div>+ <div className="flex min-w-0 flex-1 flex-col">+ {wallpaper ? (+ <>+ <MiniField label="Padding" value="10%" fill={0.25} />+ <MiniField label="Corners" value="7.5%" fill={0.075} />+ </>+ ) : (+ <>+ <MiniField label="Angle" value="90°" fill={0.25} />+ <MiniField label="Noise" value="0" fill={0} />+ </>+ )}+ </div>+ </div>+ </Panel>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/captions.tsx b/apps/web/components/pages/HomeTwo/studio/cards/captions.tsxnew file mode 100644index 000000000..fde1d2b21--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/captions.tsx@@ -0,0 +1,211 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import { useRef } from "react";+import { LucideChevronDown } from "../../demo/capIcons";+import { useCursor, useSceneState, type Way } from "../../scenes/engine";+import {+ ED,+ EditorButton,+ Field,+ Ground,+ Panel,+ RecordedWindow,+ Toggle,+ useLoop,+} from "../shared";++/* Captions, generated locally: the caption itself is the hero, with the+ * active word highlighted the way the Karaoke style does it. The Captions+ * tab beside it is the real one: a local model, a language, Generate. */++const WIN = { left: 10, top: 38, scale: 1.12 };+const PANEL = { left: 368, top: 12, w: 196, scale: 1.1 };+const LINES = [+ { start: 500, words: "Here is the new dashboard".split(" ") },+ { start: 4400, words: "Every card pulls live data".split(" ") },+];+const WORD_MS = 380;+const TOGGLE_AT = 7600;+const DURATION = 9000;+const TOGGLE = {+ x: PANEL.left + 151 * PANEL.scale,+ y: PANEL.top + 283 * PANEL.scale,+};++const PATH: Way[] = [+ { t: 0, x: 300, y: 190 },+ { t: 6400, x: 300, y: 190 },+ { t: 7300, ...TOGGLE },+ { t: TOGGLE_AT, ...TOGGLE, click: true },+ { t: 8400, x: TOGGLE.x - 40, y: TOGGLE.y + 60 },+ { t: DURATION, x: TOGGLE.x - 40, y: TOGGLE.y + 60 },+];++const uiAt = (t: number) => {+ let line = 0;+ for (let i = 0; i < LINES.length; i++) {+ if (t >= (LINES[i]?.start ?? 0)) line = i;+ }+ const current = LINES[line];+ const elapsed = t - (current?.start ?? 0);+ const active = Math.min(+ (current?.words.length ?? 1) - 1,+ Math.floor(Math.max(0, elapsed) / WORD_MS),+ );+ return {+ line,+ active,+ shown: t >= (LINES[0]?.start ?? 0),+ exportOn: t >= TOGGLE_AT,+ };+};++const SelectBox = ({+ children,+ sub,+ right,+}: {+ children: React.ReactNode;+ sub?: string;+ right?: string;+}) => (+ <div+ className="flex items-center justify-between gap-2 rounded-lg px-2.5"+ style={{+ minHeight: sub ? 44 : 32,+ boxShadow: `inset 0 0 0 1px ${ED.lineStrong}`,+ background: ED.card,+ }}+ >+ <span className="flex min-w-0 flex-col leading-tight">+ <span className="text-[13px]" style={{ color: ED.text1 }}>+ {children}+ </span>+ {sub ? (+ <span+ className="whitespace-nowrap text-[10px]"+ style={{ color: ED.text3 }}+ >+ {sub}+ </span>+ ) : null}+ </span>+ <span className="flex shrink-0 items-center gap-1.5">+ {right ? (+ <span className="text-[11px] tabular-nums" style={{ color: ED.text3 }}>+ {right}+ </span>+ ) : null}+ <LucideChevronDown className="size-3.5" style={{ color: ED.text3 }} />+ </span>+ </div>+);++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState(uiAt(0));+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 2200,+ tick: (t, seek) => {+ setUi(uiAt(t));+ cursor.tick(PATH, t, seek);+ },+ });++ const line = LINES[ui.line] ?? LINES[0];++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="light">+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />+ <div+ className="pointer-events-none absolute rounded-[10px]"+ style={{+ left: WIN.left,+ top: WIN.top,+ width: 360 * WIN.scale,+ height: 250 * WIN.scale,+ background: "rgba(9,12,20,0.16)",+ }}+ />++ <div+ className="absolute z-20 flex items-center gap-x-1.5 whitespace-nowrap rounded-xl px-4 py-2 transition-opacity duration-300"+ style={{+ left: 22,+ top: 299,+ background: "rgba(17,17,17,0.74)",+ opacity: ui.shown ? 1 : 0,+ }}+ >+ {line?.words.map((word, i) => (+ <span+ key={`${ui.line}-${word}-${i}`}+ className={classNames(+ "rounded-md px-1.5 py-1 text-[20px] font-medium leading-none",+ i === ui.active ? "text-white" : "text-white/90",+ )}+ style={{ background: i === ui.active ? ED.accent : undefined }}+ >+ {word}+ </span>+ ))}+ </div>++ <div+ className="absolute z-30"+ style={{+ left: PANEL.left,+ top: PANEL.top,+ width: PANEL.w,+ transform: `scale(${PANEL.scale})`,+ transformOrigin: "top left",+ }}+ >+ <Panel className="left-0 top-0 w-full gap-3">+ <div className="flex min-h-[22px] items-center gap-1.5">+ <span+ className="text-[12px] font-medium"+ style={{ color: ED.text2 }}+ >+ Captions+ </span>+ <span+ className="rounded-full px-1.5 py-0.5 text-[10px] font-medium"+ style={{ background: ED.ctl, color: ED.text2 }}+ >+ Beta+ </span>+ </div>+ <Field label="Model">+ <SelectBox sub="parakeet-tdt-0.6b-v3 int8" right="~640MB">+ Recommended+ </SelectBox>+ </Field>+ <Field label="Language">+ <SelectBox>English</SelectBox>+ </Field>+ <EditorButton primary className="w-full justify-center">+ Generate Captions+ </EditorButton>+ <div className="flex items-center justify-between gap-3 pt-1">+ <span+ className="text-[13px] leading-tight"+ style={{ color: ED.text1 }}+ >+ Export with Subtitles+ </span>+ <Toggle on={ui.exportOn} />+ </div>+ </Panel>+ </div>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/clips.tsx b/apps/web/components/pages/HomeTwo/studio/cards/clips.tsxnew file mode 100644index 000000000..8227288d8--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/clips.tsx@@ -0,0 +1,326 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import { useRef } from "react";+import { CapAudioOn, CapClapperboard, LucidePlus } from "../../demo/capIcons";+import {+ easeInOut,+ lerp,+ span,+ useCursor,+ useSceneState,+ type Way,+} from "../../scenes/engine";+import {+ CANVAS,+ ED,+ Ground,+ HUE,+ Lane,+ mix,+ Playhead,+ RULER_H,+ Ruler,+ Segment,+ SpeedChip,+ TRACK_GAP,+ TRACK_GUTTER,+ TRACK_H,+ TrackLabel,+ useLoop,+ Waveform,+} from "../shared";++/* Clips, speed, and music: the timeline card, nothing else. Trim a clip,+ * flip the second one to 2x, add a crossfade, then lay a library track+ * underneath. Sizes are the editor's own, scaled up to read at card size. */++const S = 1.5;+const LOGICAL = { w: CANVAS.w / S, h: CANVAS.h / S };+const INSET = 14;+const PAD = 12;+const CARD = {+ x: INSET,+ w: LOGICAL.w - INSET * 2,+ h: 10 + RULER_H + TRACK_GAP + TRACK_H + TRACK_GAP + TRACK_H + PAD,+};+const CARD_Y = Math.round((LOGICAL.h - CARD.h) / 2) + 4;+const LANE_X = CARD.x + PAD + TRACK_GUTTER;+const LANE_W = CARD.w - PAD * 2 - TRACK_GUTTER;+const VIDEO_Y = CARD_Y + 10 + RULER_H + TRACK_GAP;+const AUDIO_Y = VIDEO_Y + TRACK_H + TRACK_GAP;++const DURATION = 10000;+const CLIP_A = {+ start: Math.round(LANE_W * 0.48),+ trimmed: Math.round(LANE_W * 0.38),+};+const CLIP_B = {+ start: Math.round(LANE_W * 0.44),+ fast: Math.round(LANE_W * 0.32),+};+const JOIN = 4;+const TRIM = { start: 2200, end: 3400 };+const SPEED_AT = 3900;+const FADE_AT = 5200;+const AUDIO_AT = 6400;++const g = (x: number, y: number) => ({ x: x * S, y: y * S });+const mid = VIDEO_Y + TRACK_H / 2;++const PATH: Way[] = [+ { t: 0, ...g(LANE_X + 40, CARD_Y - 6) },+ { t: 1900, ...g(LANE_X + CLIP_A.start + 1, mid) },+ { t: TRIM.start, ...g(LANE_X + CLIP_A.start + 1, mid) },+ { t: TRIM.end, ...g(LANE_X + CLIP_A.trimmed + 1, mid) },+ {+ t: SPEED_AT - 150,+ ...g(LANE_X + CLIP_A.trimmed + JOIN + CLIP_B.start - 22, mid),+ },+ {+ t: SPEED_AT,+ ...g(LANE_X + CLIP_A.trimmed + JOIN + CLIP_B.start - 22, mid),+ click: true,+ },+ { t: FADE_AT - 150, ...g(LANE_X + CLIP_A.trimmed + JOIN / 2, mid) },+ { t: FADE_AT, ...g(LANE_X + CLIP_A.trimmed + JOIN / 2, mid), click: true },+ { t: AUDIO_AT + 400, ...g(LANE_X + LANE_W - 24, AUDIO_Y + TRACK_H + 14) },+ { t: DURATION, ...g(LANE_X + LANE_W - 24, AUDIO_Y + TRACK_H + 14) },+];++const uiAt = (t: number) => ({+ trimmed: t >= TRIM.start + 400,+ speed: t >= SPEED_AT,+ fade: t >= FADE_AT,+ audio: t >= AUDIO_AT,+});++const widthsAt = (t: number) => {+ const trim = easeInOut(span(t, TRIM.start, TRIM.end));+ const a = lerp(CLIP_A.start, CLIP_A.trimmed, trim);+ const b = t >= SPEED_AT ? CLIP_B.fast : CLIP_B.start;+ return { a, b };+};++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const clipARef = useRef<HTMLDivElement | null>(null);+ const clipBRef = useRef<HTMLDivElement | null>(null);+ const seamRef = useRef<HTMLDivElement | null>(null);+ const playheadRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState(uiAt(0));+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 7200,+ tick: (t, seek) => {+ setUi(uiAt(t));+ const { a, b } = widthsAt(t);+ if (clipARef.current) clipARef.current.style.width = `${a}px`;+ if (clipBRef.current) {+ clipBRef.current.style.left = `${a + JOIN}px`;+ clipBRef.current.style.width = `${b}px`;+ }+ if (seamRef.current) seamRef.current.style.left = `${a - 6}px`;+ const frac = (t % 3200) / 3200;+ const split = t >= SPEED_AT ? 0.66 : a / (a + b);+ const head =+ frac < split+ ? lerp(0, a, frac / split)+ : lerp(a + JOIN, a + JOIN + b, (frac - split) / (1 - split));+ if (playheadRef.current) {+ playheadRef.current.style.transform = `translateX(${head}px)`;+ }+ cursor.tick(PATH, t, seek);+ },+ });++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="chrome">+ <div+ className="absolute left-0 top-0"+ style={{+ width: LOGICAL.w,+ height: LOGICAL.h,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ <span+ className="absolute left-1/2 h-1 w-9 -translate-x-1/2 rounded-full"+ style={{ top: CARD_Y - 12, background: ED.lineStrong }}+ />+ <div+ className="absolute rounded-xl"+ style={{+ left: CARD.x,+ top: CARD_Y,+ width: CARD.w,+ height: CARD.h,+ background: ED.card,+ boxShadow: ED.cardShadow,+ }}+ />++ <div+ className="absolute flex items-end"+ style={{+ left: CARD.x + PAD,+ top: CARD_Y + 10,+ width: CARD.w - PAD * 2,+ }}+ >+ <div+ className="flex shrink-0 items-end pb-1"+ style={{ width: TRACK_GUTTER }}+ >+ <span+ className="inline-flex h-6 items-center gap-1 rounded-md pl-1.5 pr-2 text-[12px] font-medium"+ style={{ background: ED.ctl, color: ED.text2 }}+ >+ <LucidePlus className="size-3" />+ Add track+ </span>+ </div>+ <Ruler+ labels={["0:00", "0:05", "0:10", "0:15", "0:20", "0:25"]}+ span={5.6}+ />+ </div>++ <div+ className="absolute flex"+ style={{+ left: CARD.x + PAD,+ top: VIDEO_Y,+ width: CARD.w - PAD * 2,+ }}+ >+ <TrackLabel+ hue={HUE.clip}+ icon={<CapClapperboard className="size-3.5" />}+ >+ Clip+ </TrackLabel>+ <Lane>+ <Segment+ hue={HUE.clip}+ segmentRef={clipARef}+ label="Clip 1"+ sublabel={ui.trimmed ? undefined : "0:14"}+ trailing={<SpeedChip>1x</SpeedChip>}+ style={{ left: 0, width: CLIP_A.start }}+ >+ <Waveform from={0} to={34} />+ </Segment>+ <Segment+ hue={HUE.clip}+ segmentRef={clipBRef}+ label="Clip 2"+ sublabel={ui.speed ? undefined : "0:10"}+ trailing={+ <SpeedChip active={ui.speed}>+ {ui.speed ? "2x" : "1x"}+ </SpeedChip>+ }+ style={{ left: CLIP_A.start + JOIN, width: CLIP_B.start }}+ >+ <Waveform from={18} to={44} />+ </Segment>+ <div+ ref={seamRef}+ className={classNames(+ "pointer-events-none absolute inset-y-0 w-4 rounded-sm border-x transition-opacity duration-300",+ ui.fade ? "opacity-100" : "opacity-0",+ )}+ style={{+ left: CLIP_A.start - 6,+ borderColor: mix(ED.accent, 60, "transparent"),+ background: `repeating-linear-gradient(135deg, ${mix(ED.accent, 22, "transparent")} 0 3px, transparent 3px 6px)`,+ }}+ >+ <span+ className="absolute -top-[26px] left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md px-1.5 py-0.5 text-[10px] font-medium"+ style={{+ background: ED.card,+ color: ED.text1,+ boxShadow: ED.popShadow,+ }}+ >+ Crossfade · 0.5s+ </span>+ </div>+ </Lane>+ </div>++ <div+ className="absolute flex"+ style={{+ left: CARD.x + PAD,+ top: AUDIO_Y,+ width: CARD.w - PAD * 2,+ }}+ >+ <TrackLabel+ hue={HUE.audio}+ icon={<CapAudioOn className="size-3.5" />}+ >+ Audio+ </TrackLabel>+ <Lane+ empty={ui.audio ? undefined : "Add audio, music or other sounds"}+ >+ <Segment+ hue={HUE.audio}+ label="Lofi Beats"+ sublabel="24s"+ className={classNames(+ "transition-[opacity,transform] duration-500",+ ui.audio+ ? "translate-y-0 opacity-100"+ : "translate-y-1 opacity-0",+ )}+ style={{ left: 0, width: LANE_W * 0.92 }}+ >+ <svg+ aria-hidden="true"+ className="pointer-events-none absolute inset-0 h-full w-full"+ viewBox="0 0 100 44"+ preserveAspectRatio="none"+ >+ <path+ d="M0 44 L0 40 L8 8 L92 8 L100 40 L100 44 Z"+ fill={mix(HUE.audio, 10, "transparent")}+ />+ <path+ d="M0 40 L8 8 L92 8 L100 40"+ fill="none"+ stroke={mix(HUE.audio, 55, "transparent")}+ strokeWidth="1"+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ <Waveform color={mix(HUE.audio, 40, "transparent")} />+ </Segment>+ </Lane>+ </div>++ <div+ className="pointer-events-none absolute"+ style={{ left: LANE_X, top: VIDEO_Y - 12, width: LANE_W }}+ >+ <Playhead+ playheadRef={playheadRef}+ top={0}+ bottom={-(TRACK_H * 2 + TRACK_GAP + 12)}+ />+ </div>+ </div>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/grades.tsx b/apps/web/components/pages/HomeTwo/studio/cards/grades.tsxnew file mode 100644index 000000000..e914e1710--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/grades.tsx@@ -0,0 +1,332 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import { useRef } from "react";+import {+ easeOut,+ span,+ useCursor,+ useSceneState,+ type Way,+} from "../../scenes/engine";+import {+ CANVAS,+ ED,+ Field,+ Ground,+ Panel,+ RecordedWindow,+ SectionTitle,+ Slider,+ useLoop,+} from "../shared";++/* Color grades: a before/after wipe across the whole frame (background+ * included) each time a preset is picked in the editor's real+ * "Color correction" section. */++type Grade = { name: string; filter: string; tint: string };++const GRADES: Grade[] = [+ { name: "None", filter: "none", tint: "transparent" },+ {+ name: "Cinematic",+ filter: "contrast(1.15) saturate(0.82) sepia(0.12)",+ tint: "rgba(24,52,92,0.18)",+ },+ {+ name: "Noir",+ filter: "grayscale(1) contrast(1.25) brightness(0.96)",+ tint: "rgba(0,0,0,0.08)",+ },+ {+ name: "Vintage",+ filter: "sepia(0.45) contrast(0.95) brightness(1.04) saturate(0.9)",+ tint: "rgba(255,196,120,0.16)",+ },+ {+ name: "Frost",+ filter: "saturate(0.75) brightness(1.06) hue-rotate(-8deg)",+ tint: "rgba(168,208,255,0.24)",+ },+ {+ name: "Golden",+ filter: "sepia(0.3) saturate(1.2) brightness(1.03)",+ tint: "rgba(255,186,74,0.2)",+ },+ {+ name: "Midnight",+ filter: "brightness(0.82) contrast(1.15) saturate(0.9) hue-rotate(12deg)",+ tint: "rgba(22,30,86,0.3)",+ },+ {+ name: "Vivid",+ filter: "saturate(1.55) contrast(1.08)",+ tint: "transparent",+ },+ {+ name: "Dreamy",+ filter: "brightness(1.08) contrast(0.88) saturate(1.15)",+ tint: "rgba(255,190,230,0.18)",+ },+];++const GROUND_GRADIENT =+ "linear-gradient(135deg, #C3DCF8 0%, #DACBF9 55%, #F6D9EC 100%)";++const DURATION = 9600;+const STOPS: { name: string; at: number }[] = [+ { name: "Cinematic", at: 1000 },+ { name: "Noir", at: 2400 },+ { name: "Golden", at: 3800 },+ { name: "Midnight", at: 5200 },+ { name: "Vivid", at: 6600 },+ { name: "Dreamy", at: 8000 },+];+const SWEEP = 900;+const WIPE_MAX = 0.52;++const WIN = { left: 10, top: 46, scale: 0.95 } as const;+const S = 1.3;+const PANEL = { w: 190, pad: 12 } as const;+const PANEL_POS = { left: CANVAS.w - PANEL.w * S - 12, top: 18 } as const;+const SWATCH = { w: 50, h: 28, gap: 8, label: 14 } as const;+const GRID_TOP = PANEL.pad + 22 + 10;++const swatchCenter = (index: number) => {+ const row = Math.floor(index / 3);+ const col = index % 3;+ return {+ x:+ PANEL_POS.left ++ (PANEL.pad + col * (SWATCH.w + SWATCH.gap) + SWATCH.w / 2) * S,+ y:+ PANEL_POS.top ++ (GRID_TOP + row * (SWATCH.h + SWATCH.label + SWATCH.gap) + SWATCH.h / 2) *+ S,+ };+};++const PATH: Way[] = [+ { t: 0, x: 300, y: 330 },+ ...STOPS.flatMap((stop) => {+ const point = swatchCenter(GRADES.findIndex((g) => g.name === stop.name));+ return [+ { t: stop.at - 220, ...point },+ { t: stop.at, ...point, click: true },+ ];+ }),+ { t: DURATION - 700, x: 290, y: 330 },+ { t: DURATION, x: 290, y: 330 },+];++const gradeAt = (t: number) => {+ let current = "None";+ for (const stop of STOPS) if (t >= stop.at) current = stop.name;+ return current;+};++const wipeAt = (t: number) => {+ let latest: (typeof STOPS)[number] | undefined;+ for (const stop of STOPS) if (t >= stop.at) latest = stop;+ if (!latest) return 0;+ return easeOut(span(t, latest.at, latest.at + SWEEP)) * WIPE_MAX;+};++const Scene = ({ grade }: { grade: Grade }) => (+ <span+ className="relative block overflow-hidden rounded-md"+ style={{+ width: SWATCH.w,+ height: SWATCH.h,+ background:+ "linear-gradient(160deg, #f7c27a 0%, #e98a9c 45%, #5a7fd8 100%)",+ filter: grade.filter,+ }}+ >+ <span+ className="absolute rounded-full"+ style={{+ left: 8,+ top: 6,+ width: 9,+ height: 9,+ background: "#fff4d6",+ boxShadow: "0 0 6px rgba(255,244,214,0.9)",+ }}+ />+ <span+ className="absolute inset-x-0 bottom-0"+ style={{ height: 9, background: "rgba(26,32,64,0.55)" }}+ />+ <span+ className="absolute inset-0"+ style={{ background: grade.tint, mixBlendMode: "multiply" }}+ />+ </span>+);++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const gradedRef = useRef<HTMLDivElement | null>(null);+ const lineRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState({ grade: "None" });+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 4600,+ tick: (t, seek) => {+ setUi({ grade: gradeAt(t) });+ const wipe = wipeAt(t);+ if (gradedRef.current) {+ gradedRef.current.style.clipPath = `inset(0 ${(1 - wipe) * 100}% 0 0)`;+ }+ if (lineRef.current) {+ lineRef.current.style.transform = `translateX(${wipe * CANVAS.w}px)`;+ lineRef.current.style.opacity = wipe > 0.005 ? "1" : "0";+ }+ cursor.tick(PATH, t, seek);+ },+ });++ const grade = GRADES.find((item) => item.name === ui.grade) ?? GRADES[0];+ const graded = grade?.name !== "None";++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="gradient">+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />++ <div+ ref={gradedRef}+ className="pointer-events-none absolute inset-0 transition-[filter] duration-500"+ style={{+ clipPath: "inset(0 100% 0 0)",+ filter: grade?.filter,+ }}+ >+ <div+ className="absolute inset-0"+ style={{ background: GROUND_GRADIENT }}+ />+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />+ <div+ className="absolute inset-0 transition-[background-color] duration-500"+ style={{ background: grade?.tint, mixBlendMode: "multiply" }}+ />+ <div+ className="absolute inset-0"+ style={{+ background:+ "radial-gradient(85% 75% at 50% 50%, rgba(9,12,20,0) 55%, rgba(9,12,20,0.45) 100%)",+ }}+ />+ </div>++ <div+ ref={lineRef}+ className="pointer-events-none absolute inset-y-0 left-0 z-20 w-px opacity-0 transition-opacity duration-300 will-change-transform"+ style={{+ background: "rgba(255,255,255,0.95)",+ boxShadow: "0 0 0 1px rgba(0,0,0,0.12)",+ }}+ >+ <span+ className="absolute left-1/2 top-1/2 flex size-7 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full"+ style={{+ background: "#ffffff",+ boxShadow: "0 4px 14px rgba(0,0,0,0.25)",+ }}+ >+ <svg+ aria-hidden="true"+ viewBox="0 0 16 16"+ className="size-3"+ fill="none"+ stroke={ED.text1}+ strokeWidth="1.6"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ <path d="M6 4 2 8l4 4M10 4l4 4-4 4" />+ </svg>+ </span>+ </div>++ <div+ className="absolute z-20 flex h-7 items-center gap-1.5 rounded-lg px-2.5 text-[12px] font-medium transition-opacity duration-300"+ style={{+ left: 20,+ top: 10,+ background: ED.card,+ color: ED.text1,+ boxShadow: ED.popShadow,+ opacity: graded ? 1 : 0,+ }}+ >+ <span+ className="size-2 rounded-full"+ style={{ background: ED.accent }}+ />+ {grade?.name}+ </div>++ <Panel+ className="z-30 gap-2.5"+ style={{+ left: PANEL_POS.left,+ top: PANEL_POS.top,+ width: PANEL.w,+ padding: PANEL.pad,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ <SectionTitle>Color correction</SectionTitle>+ <div+ className="grid grid-cols-3"+ style={{ gap: SWATCH.gap, rowGap: SWATCH.gap }}+ >+ {GRADES.map((item) => {+ const selected = ui.grade === item.name;+ return (+ <span+ key={item.name}+ className="flex flex-col items-start gap-0.5"+ >+ <span+ className={classNames(+ "rounded-md transition-shadow duration-200",+ selected && "ring-2 ring-offset-2",+ )}+ style={{+ boxShadow: selected+ ? undefined+ : `0 0 0 0.5px ${ED.line}`,+ ["--tw-ring-color" as string]: ED.accent,+ ["--tw-ring-offset-color" as string]: ED.card,+ }}+ >+ <Scene grade={item} />+ </span>+ <span+ className="text-[10px] leading-[14px]"+ style={{ color: selected ? ED.text1 : ED.text2 }}+ >+ {item.name}+ </span>+ </span>+ );+ })}+ </div>+ <Field label="Grain" value="0%">+ <Slider fill={0} />+ </Field>+ </Panel>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/mask.tsx b/apps/web/components/pages/HomeTwo/studio/cards/mask.tsxnew file mode 100644index 000000000..5b5c8d760--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/mask.tsx@@ -0,0 +1,198 @@+"use client";++import { useRef } from "react";+import {+ easeOut,+ lerp,+ span,+ useCursor,+ useSceneState,+ type Way,+} from "../../scenes/engine";+import { ED, Ground, RecordedWindow, Segmented, useLoop } from "../shared";++/* Blur what is private: the mask is drawn on the canvas exactly as the+ * editor draws it (2px #202020 box, black handles), and the real choices+ * follow: Sensitive or Highlight, then the Effect, Blur or Pixelate. */++const WIN = { left: 40, top: 44, scale: 1.45 };+const MASK = {+ x: WIN.left + Math.round(72 * WIN.scale),+ y: WIN.top + Math.round(112 * WIN.scale),+ w: Math.round(268 * WIN.scale),+ h: Math.round(52 * WIN.scale),+};+const DURATION = 8200;+const DRAG = { start: 600, end: 1700 };+const BLUR_AT = 1900;+const PIXELATE_AT = 3600;+const HIGHLIGHT_AT = 5400;+const KIND = ["Sensitive", "Highlight"] as const;+const EFFECT = ["Blur", "Pixelate"] as const;+const ITEM_W = 78;+const CARD = { x: MASK.x, y: MASK.y + MASK.h + 12, pad: 8, gap: 12 };+const kindCenter = (i: number) => ({+ x: CARD.x + CARD.pad + 2 + ITEM_W * (i + 0.5),+ y: CARD.y + CARD.pad + 2 + 13,+});+const EFFECT_X = CARD.x + CARD.pad + ITEM_W * 2 + 4 + CARD.gap + 46;+const effectCenter = (i: number) => ({+ x: EFFECT_X + 2 + ITEM_W * (i + 0.5),+ y: CARD.y + CARD.pad + 2 + 13,+});++const PATH: Way[] = [+ { t: 0, x: MASK.x - 40, y: MASK.y - 30 },+ { t: DRAG.start, x: MASK.x, y: MASK.y },+ { t: DRAG.end, x: MASK.x + MASK.w, y: MASK.y + MASK.h },+ { t: BLUR_AT, x: MASK.x + MASK.w, y: MASK.y + MASK.h },+ { t: 3400, ...effectCenter(1) },+ { t: PIXELATE_AT, ...effectCenter(1), click: true },+ { t: 5200, ...kindCenter(1) },+ { t: HIGHLIGHT_AT, ...kindCenter(1), click: true },+ { t: 6600, x: MASK.x + MASK.w + 40, y: CARD.y + 70 },+ { t: DURATION, x: MASK.x + MASK.w + 40, y: CARD.y + 70 },+];++const PIXELS = Array.from({ length: 22 * 4 }, (_, i) => {+ const seed = Math.sin(i * 12.9898 + 4.1414) * 43758.5453;+ const v = seed - Math.floor(seed);+ const l = 62 + Math.floor(v * 30);+ return `hsl(216 22% ${l}%)`;+});++const HANDLES = [+ [0, 0],+ [0.5, 0],+ [1, 0],+ [0, 0.5],+ [1, 0.5],+ [0, 1],+ [0.5, 1],+ [1, 1],+] as const;++const uiAt = (t: number) => ({+ drawing: t >= DRAG.start && t < BLUR_AT,+ kind: t >= HIGHLIGHT_AT ? "Highlight" : t >= BLUR_AT ? "Sensitive" : null,+ effect: t >= PIXELATE_AT ? "Pixelate" : "Blur",+});++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const boxRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState(uiAt(0));+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 4400,+ tick: (t, seek) => {+ setUi(uiAt(t));+ const drag = easeOut(span(t, DRAG.start, DRAG.end));+ if (boxRef.current) {+ boxRef.current.style.width = `${lerp(0, MASK.w, drag)}px`;+ boxRef.current.style.height = `${lerp(0, MASK.h, drag)}px`;+ boxRef.current.style.opacity = t >= DRAG.start ? "1" : "0";+ }+ cursor.tick(PATH, t, seek);+ },+ });++ const applied = ui.kind !== null;+ const highlight = ui.kind === "Highlight";+ const blur = applied && !highlight && ui.effect === "Blur";+ const pixelate = applied && !highlight && ui.effect === "Pixelate";++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="light">+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />++ <div+ ref={boxRef}+ className="pointer-events-none absolute z-20 overflow-hidden rounded-md"+ style={{+ left: MASK.x,+ top: MASK.y,+ width: 0,+ height: 0,+ opacity: 0,+ border: `2px ${applied ? "solid" : "dashed"} #202020`,+ boxShadow: highlight+ ? "0 0 0 9999px rgba(9,12,20,0.5)"+ : "0 0 0 9999px rgba(9,12,20,0)",+ transition: "box-shadow 420ms ease",+ }}+ >+ <div+ className="absolute inset-0 transition-opacity duration-300"+ style={{+ opacity: blur ? 1 : 0,+ backdropFilter: "blur(10px) saturate(1.2)",+ WebkitBackdropFilter: "blur(10px) saturate(1.2)",+ background: "rgba(236,240,246,0.35)",+ }}+ />+ <div+ className="absolute inset-0 grid transition-opacity duration-300"+ style={{+ opacity: pixelate ? 1 : 0,+ gridTemplateColumns: "repeat(22, 1fr)",+ gridTemplateRows: "repeat(4, 1fr)",+ }}+ >+ {PIXELS.map((color, i) => (+ <span key={`${i}-${color}`} style={{ background: color }} />+ ))}+ </div>+ </div>++ {HANDLES.map(([fx, fy]) => (+ <span+ key={`${fx}-${fy}`}+ className="pointer-events-none absolute z-30 size-3 rounded-full border border-white transition-opacity duration-300"+ style={{+ left: MASK.x + MASK.w * fx - 6,+ top: MASK.y + MASK.h * fy - 6,+ background: "#202020",+ opacity: applied ? 1 : 0,+ }}+ />+ ))}++ <div+ className="absolute z-30 flex items-center rounded-xl transition-[opacity,transform] duration-300"+ style={{+ left: CARD.x,+ top: CARD.y,+ padding: CARD.pad,+ gap: CARD.gap,+ background: ED.card,+ boxShadow: ED.popShadow,+ opacity: applied ? 1 : 0,+ transform: applied ? "translateY(0)" : "translateY(6px)",+ }}+ >+ <Segmented options={KIND} value={ui.kind} itemWidth={ITEM_W} />+ <div className="flex items-center gap-2">+ <span+ className="text-[12px] font-medium"+ style={{ color: ED.text2 }}+ >+ Effect+ </span>+ <Segmented+ options={EFFECT}+ value={ui.effect}+ itemWidth={ITEM_W}+ disabled={highlight}+ />+ </div>+ </div>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/scenes.tsx b/apps/web/components/pages/HomeTwo/studio/cards/scenes.tsxnew file mode 100644index 000000000..419426dd3--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/scenes.tsx@@ -0,0 +1,306 @@+"use client";++import { useRef } from "react";+import { LucideVideo } from "../../demo/capIcons";+import { useVideoAttrs, VIDEO_POSTERS } from "../../demo/media";+import {+ useCursor,+ useSceneState,+ useVideo,+ type Way,+} from "../../scenes/engine";+import {+ CANVAS,+ ED,+ Field,+ Ground,+ HUE,+ Lane,+ Panel,+ Playhead,+ RecordedWindow,+ Segment,+ Tile,+ TRACK_GUTTER,+ TRACK_H,+ TrackLabel,+ useLoop,+} from "../shared";++/* Scenes for screen and camera: the editor's Camera Layout tiles, clicked+ * one by one, re-arrange the screen and the camera inside the frame. The+ * camera is the subject here, so this is the one card with the webcam. */++const MODES = [+ "Default",+ "Camera Only",+ "Hide Camera",+ "Split Screen",+ "Floating",+] as const;+type Mode = (typeof MODES)[number];+const SEQUENCE: Mode[] = ["Default", "Camera Only", "Split Screen", "Floating"];+const SLOT = 3000;+const DURATION = SLOT * SEQUENCE.length;++const FRAME = { left: 16, top: 48, w: 306, h: 172 };+const SCREEN = { w: 278, h: 150 };+const PANEL = { left: 338, top: 44, w: 196, scale: 1.25 };++type Box = {+ left: number;+ top: number;+ w: number;+ h: number;+ r: number;+ opacity: number;+};++const LAYOUT: Record<Mode, { screen: Box & { scale: number }; camera: Box }> = {+ Default: {+ screen: { left: 14, top: 11, w: 278, h: 150, r: 8, opacity: 1, scale: 1 },+ camera: { left: 12, top: 80, w: 80, h: 80, r: 40, opacity: 1 },+ },+ "Camera Only": {+ screen: { left: 14, top: 11, w: 278, h: 150, r: 8, opacity: 0, scale: 1 },+ camera: { left: 0, top: 0, w: FRAME.w, h: FRAME.h, r: 8, opacity: 1 },+ },+ "Hide Camera": {+ screen: { left: 14, top: 11, w: 278, h: 150, r: 8, opacity: 1, scale: 1 },+ camera: { left: 12, top: 80, w: 80, h: 80, r: 40, opacity: 0 },+ },+ "Split Screen": {+ screen: {+ left: 8,+ top: 22,+ w: 145,+ h: 128,+ r: 8,+ opacity: 1,+ scale: 128 / SCREEN.h,+ },+ camera: { left: 153, top: 22, w: 145, h: 128, r: 8, opacity: 1 },+ },+ Floating: {+ screen: {+ left: 10,+ top: 35,+ w: 190,+ h: 102,+ r: 8,+ opacity: 1,+ scale: 190 / SCREEN.w,+ },+ camera: { left: 206, top: 40, w: 92, h: 92, r: 14, opacity: 1 },+ },+};++const EASE = "cubic-bezier(0.22, 1, 0.36, 1)";+const MOVE = `left 480ms ${EASE}, top 480ms ${EASE}, width 480ms ${EASE}, height 480ms ${EASE}, border-radius 480ms ${EASE}, opacity 320ms ease, transform 480ms ${EASE}`;++const tileCenter = (mode: Mode) => {+ const i = MODES.indexOf(mode);+ const col = i % 2;+ const row = Math.floor(i / 2);+ const x = 16 + col * 86 + 39;+ const y = 43.5 + row * 38 + 15;+ return { x: PANEL.left + x * PANEL.scale, y: PANEL.top + y * PANEL.scale };+};++const PATH: Way[] = [+ { t: 0, ...tileCenter("Default") },+ { t: 150, ...tileCenter("Default"), click: true },+ { t: 1200, ...tileCenter("Default") },+ { t: SLOT - 300, ...tileCenter("Camera Only") },+ { t: SLOT, ...tileCenter("Camera Only"), click: true },+ { t: SLOT + 1200, ...tileCenter("Camera Only") },+ { t: SLOT * 2 - 300, ...tileCenter("Split Screen") },+ { t: SLOT * 2, ...tileCenter("Split Screen"), click: true },+ { t: SLOT * 2 + 1200, ...tileCenter("Split Screen") },+ { t: SLOT * 3 - 300, ...tileCenter("Floating") },+ { t: SLOT * 3, ...tileCenter("Floating"), click: true },+ { t: SLOT * 3 + 1200, ...tileCenter("Floating") },+ { t: DURATION - 300, ...tileCenter("Default") },+ { t: DURATION, ...tileCenter("Default") },+];++const modeAt = (t: number): Mode =>+ SEQUENCE[Math.min(SEQUENCE.length - 1, Math.floor(t / SLOT))] ?? "Default";++const S = 1.15;+const LOGICAL = { w: CANVAS.w / S, h: CANVAS.h / S };+const STRIP = { left: 12, top: 254, pad: 8 };+const STRIP_W = LOGICAL.w - STRIP.left * 2;+const LANE_W = STRIP_W - STRIP.pad * 2 - TRACK_GUTTER;++const CameraPane = ({ playing, box }: { playing: boolean; box: Box }) => {+ const ref = useRef<HTMLVideoElement | null>(null);+ const attrs = useVideoAttrs(VIDEO_POSTERS.webcam);+ useVideo(playing, ref);+ return (+ <div+ className="absolute overflow-hidden bg-[#111111]"+ style={{+ left: box.left,+ top: box.top,+ width: box.w,+ height: box.h,+ borderRadius: box.r,+ opacity: box.opacity,+ boxShadow: "0 14px 34px rgba(0,0,0,0.28)",+ transition: MOVE,+ }}+ >+ <video+ ref={ref}+ className="h-full w-full object-cover"+ src="/videos/home-two/webcam.mp4"+ muted+ loop+ playsInline+ {...attrs}+ />+ </div>+ );+};++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const playheadRef = useRef<HTMLDivElement | null>(null);+ const [mode, setMode] = useSceneState<Mode>("Default");+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 7000,+ tick: (t, seek) => {+ setMode(modeAt(t));+ if (playheadRef.current) {+ playheadRef.current.style.transform = `translateX(${(t / DURATION) * LANE_W}px)`;+ }+ cursor.tick(PATH, t, seek);+ },+ });++ const layout = LAYOUT[mode];++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="light">+ <div+ className="absolute overflow-hidden rounded-lg"+ style={{+ left: FRAME.left,+ top: FRAME.top,+ width: FRAME.w,+ height: FRAME.h,+ background:+ "linear-gradient(135deg, #C3DCF8 0%, #DACBF9 55%, #F6D9EC 100%)",+ boxShadow:+ "0 12px 32px -8px rgba(0,0,0,0.25), 0 0 0 0.5px rgba(0,0,0,0.12)",+ }}+ >+ <div+ className="absolute overflow-hidden"+ style={{+ left: layout.screen.left,+ top: layout.screen.top,+ width: layout.screen.w,+ height: layout.screen.h,+ borderRadius: layout.screen.r,+ opacity: layout.screen.opacity,+ transform: layout.screen.opacity ? "scale(1)" : "scale(0.94)",+ boxShadow: "0 18px 40px rgba(0,0,0,0.22)",+ transition: MOVE,+ }}+ >+ <RecordedWindow+ left={0}+ top={0}+ width={SCREEN.w}+ height={SCREEN.h}+ scale={layout.screen.scale}+ style={{ transition: `transform 480ms ${EASE}` }}+ />+ </div>+ <CameraPane playing={playing} box={layout.camera} />+ </div>++ <div+ className="absolute"+ style={{+ left: PANEL.left,+ top: PANEL.top,+ width: PANEL.w,+ transform: `scale(${PANEL.scale})`,+ transformOrigin: "top left",+ }}+ >+ <Panel className="left-0 top-0 w-full">+ <Field label="Camera Layout">+ <div className="grid grid-cols-2 gap-2">+ {MODES.map((item) => (+ <Tile+ key={item}+ selected={mode === item}+ className="overflow-hidden px-1"+ >+ {item}+ </Tile>+ ))}+ </div>+ </Field>+ </Panel>+ </div>++ <div+ className="absolute left-0 top-0"+ style={{+ width: LOGICAL.w,+ height: LOGICAL.h,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ <div+ className="absolute flex rounded-xl"+ style={{+ left: STRIP.left,+ top: STRIP.top,+ width: STRIP_W,+ padding: STRIP.pad,+ background: ED.card,+ boxShadow: ED.cardShadow,+ }}+ >+ <TrackLabel+ hue={HUE.scene}+ icon={<LucideVideo className="size-3.5" />}+ >+ Scene+ </TrackLabel>+ <Lane>+ {SEQUENCE.map((item, i) => (+ <Segment+ key={item}+ hue={HUE.scene}+ label={item}+ selected={mode === item}+ style={{+ left: `calc(${(i / SEQUENCE.length) * 100}% + ${i ? 3 : 0}px)`,+ width: `calc(${100 / SEQUENCE.length}% - 3px)`,+ }}+ />+ ))}+ <Playhead playheadRef={playheadRef} top={-6} bottom={0} />+ </Lane>+ </div>+ </div>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};++export const SCENE_TRACK_H = TRACK_H;diff --git a/apps/web/components/pages/HomeTwo/studio/cards/text.tsx b/apps/web/components/pages/HomeTwo/studio/cards/text.tsxnew file mode 100644index 000000000..0535fe8fa--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/text.tsx@@ -0,0 +1,260 @@+"use client";++import { classNames } from "@cap/utils/helpers";+import { useRef } from "react";+import { easeOut, lerp, span, typed, useSceneState } from "../../scenes/engine";+import { Chip, ED, Ground, RecordedWindow, useLoop } from "../shared";++/* Text that animates: three of the editor's text templates play over the+ * recording with their real In animation, and the Templates grid along the+ * bottom shows which one is on. */++const WIN = { left: 120, top: 12, scale: 1 };+const DURATION = 10000;+const LOWER = { enter: 400, exit: 2900 };+const STAT = { enter: 3700, exit: 6100 };+const TYPE = { enter: 6600, exit: 9400 };+const TYPEWRITER_TEXT = "Try the new flow →";++const TEMPLATES = [+ "Title",+ "Lower Third",+ "Kicker",+ "Big Stat",+ "Quote",+ "Typewriter",+] as const;+type Template = (typeof TEMPLATES)[number];++const ROW = { left: 16, top: 282, scale: 1.2, card: 73, gap: 8 };++const activeAt = (t: number): { template: Template; anim: string } | null =>+ t >= TYPE.enter - 100 && t < TYPE.exit + 300+ ? { template: "Typewriter", anim: "Typewriter" }+ : t >= STAT.enter - 100 && t < STAT.exit + 300+ ? { template: "Big Stat", anim: "Pop" }+ : t >= LOWER.enter - 100 && t < LOWER.exit + 300+ ? { template: "Lower Third", anim: "Slide up" }+ : null;++const Sample = ({ template }: { template: Template }) => {+ switch (template) {+ case "Title":+ return <span className="text-[16px] font-bold text-white">Title</span>;+ case "Lower Third":+ return (+ <span className="flex items-stretch gap-1.5">+ <span className="w-[2px] rounded-full bg-[#8FC1F7]" />+ <span className="whitespace-nowrap text-[10px] font-semibold leading-none text-white">+ Lower third+ </span>+ </span>+ );+ case "Kicker":+ return (+ <span className="text-[9px] font-bold uppercase tracking-[3px] text-white">+ Kicker+ </span>+ );+ case "Big Stat":+ return <span className="text-[22px] font-extrabold text-white">42%</span>;+ case "Quote":+ return (+ <span className="font-serif text-[13px] font-medium italic text-white">+ “Quote”+ </span>+ );+ case "Typewriter":+ return (+ <span className="font-mono text-[10px] text-white">+ Typewriter<span className="animate-pulse">_</span>+ </span>+ );+ }+};++const Selection = ({+ children,+ className,+ style,+ boxRef,+}: {+ children: React.ReactNode;+ className?: string;+ style?: React.CSSProperties;+ boxRef?: React.RefObject<HTMLDivElement | null>;+}) => (+ <div+ ref={boxRef}+ className={classNames("absolute z-20 rounded-md", className)}+ style={{+ border: `2px solid ${ED.accent}`,+ padding: "8px 12px",+ ...style,+ }}+ >+ <span+ className="absolute left-0 rounded px-1.5 py-0.5 text-[11px] font-medium text-white"+ style={{ top: -24, background: ED.accent }}+ >+ Text+ </span>+ {[+ { left: -7, top: -7 },+ { right: -7, top: -7 },+ { left: -7, bottom: -7 },+ { right: -7, bottom: -7 },+ ].map((dot) => (+ <span+ key={Object.keys(dot).join("-")}+ className="absolute size-3 rounded-full"+ style={{+ ...dot,+ background: ED.accent,+ boxShadow: "0 0 0 2px #ffffff",+ }}+ />+ ))}+ {children}+ </div>+);++export const Visual = ({ playing }: { playing: boolean }) => {+ const lowerRef = useRef<HTMLDivElement | null>(null);+ const statRef = useRef<HTMLDivElement | null>(null);+ const typeRef = useRef<HTMLDivElement | null>(null);+ const typeTextRef = useRef<HTMLSpanElement | null>(null);+ const [ui, setUi] = useSceneState(activeAt(0));+ const lastRef = useRef<{ template: Template; anim: string }>({+ template: "Lower Third",+ anim: "Slide up",+ });+ if (ui) lastRef.current = ui;++ useLoop({+ duration: DURATION,+ playing,+ pose: 4800,+ tick: (t) => {+ setUi(activeAt(t));+ if (lowerRef.current) {+ const inF = easeOut(span(t, LOWER.enter, LOWER.enter + 480));+ const outF = easeOut(span(t, LOWER.exit, LOWER.exit + 360));+ lowerRef.current.style.opacity = `${inF * (1 - outF)}`;+ lowerRef.current.style.transform = `translateY(${lerp(28, 0, inF) + outF * 18}px)`;+ }+ if (statRef.current) {+ const inF = span(t, STAT.enter, STAT.enter + 520);+ const overshoot = 1 + Math.sin(inF * Math.PI) * 0.12;+ const outF = easeOut(span(t, STAT.exit, STAT.exit + 320));+ statRef.current.style.opacity = `${easeOut(inF) * (1 - outF)}`;+ statRef.current.style.transform = `translateX(-50%) scale(${lerp(0.6, 1, easeOut(inF)) * overshoot})`;+ }+ if (typeRef.current && typeTextRef.current) {+ const outF = easeOut(span(t, TYPE.exit, TYPE.exit + 300));+ typeRef.current.style.opacity = `${t >= TYPE.enter ? 1 - outF : 0}`;+ typeTextRef.current.textContent =+ t >= TYPE.enter+ ? typed(TYPEWRITER_TEXT, t, TYPE.enter + 200, 22)+ : "";+ }+ },+ });++ const shown = ui ?? lastRef.current;++ return (+ <Ground tone="gradient">+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />+ <div+ className="pointer-events-none absolute rounded-[10px]"+ style={{+ left: WIN.left,+ top: WIN.top,+ width: 360,+ height: 250,+ background: "rgba(9,12,20,0.22)",+ }}+ />++ <Selection+ boxRef={lowerRef}+ className="opacity-0"+ style={{ left: 138, top: 186 }}+ >+ <span className="flex items-stretch gap-3">+ <span className="w-[3px] rounded-full bg-[#8FC1F7]" />+ <span className="leading-tight [text-shadow:0_2px_12px_rgba(0,0,0,0.45)]">+ <span className="block text-[22px] font-semibold text-white">+ Sofia Chen+ </span>+ <span className="block text-[13px] font-medium text-white/85">+ Head of Product+ </span>+ </span>+ </span>+ </Selection>++ <Selection+ boxRef={statRef}+ className="left-1/2 flex -translate-x-1/2 flex-col items-center opacity-0"+ style={{ top: 78, background: "rgba(17,17,17,0.72)" }}+ >+ <span className="text-[68px] font-extrabold leading-none tracking-[-0.04em] text-white [text-shadow:0_6px_30px_rgba(0,0,0,0.45)]">+ 3.2×+ </span>+ <span className="mt-2 text-[13px] font-medium uppercase tracking-[0.08em] text-white/85">+ faster onboarding+ </span>+ </Selection>++ <Selection+ boxRef={typeRef}+ className="opacity-0"+ style={{ left: 286, top: 52, background: "rgba(17,17,17,0.82)" }}+ >+ <span className="font-mono text-[17px] font-medium text-white">+ <span ref={typeTextRef} />+ <span className="ml-0.5 inline-block h-[16px] w-[2px] translate-y-[2px] animate-pulse bg-white/85" />+ </span>+ </Selection>++ <div className="absolute left-4 top-3.5 z-30">+ <Chip>In · {shown.anim}</Chip>+ </div>++ <div+ className="absolute flex"+ style={{+ left: ROW.left,+ top: ROW.top,+ gap: ROW.gap,+ transform: `scale(${ROW.scale})`,+ transformOrigin: "top left",+ }}+ >+ {TEMPLATES.map((template) => {+ const on = shown.template === template;+ return (+ <div+ key={template}+ className="relative flex h-16 shrink-0 items-center justify-center overflow-hidden rounded-lg pb-3 transition-[box-shadow] duration-300"+ style={{+ width: ROW.card,+ background: "linear-gradient(135deg,#17181c,#2a2c33)",+ boxShadow: on+ ? `0 0 0 1px ${ED.accent}, 0 0 0 3px ${ED.card}, 0 0 0 4px ${ED.accent}`+ : `0 0 0 1px rgba(255,255,255,0.08)`,+ }}+ >+ <Sample template={template} />+ <span className="absolute inset-x-0 bottom-1 text-center text-[10px] text-white/50">+ {template}+ </span>+ </div>+ );+ })}+ </div>+ </Ground>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/threeD.tsx b/apps/web/components/pages/HomeTwo/studio/cards/threeD.tsxnew file mode 100644index 000000000..f5194a3fb--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/threeD.tsx@@ -0,0 +1,230 @@+"use client";++import { useRef } from "react";+import { easeInOut, lerp, span, useSceneState } from "../../scenes/engine";+import { CANVAS, Ground, HUE, mix, RecordedWindow, useLoop } from "../shared";++/* 3D camera moves: the recording tilted into perspective, playing the+ * editor's three starter moves in a row. The starter cards along the+ * bottom are the real "Add a 3D scene" picker, in the editor's dark theme. */++const DARK = {+ card: "#1b1b1e",+ line: "rgba(255,255,255,0.08)",+ text1: "#f4f4f5",+ text2: "#9a9aa3",+ ctl: "rgba(255,255,255,0.06)",+ accent: "#0a84ff",+} as const;++const DURATION = 9000;+const MOVES = [+ {+ name: "Glide across",+ helper: "Move smoothly across the details",+ from: 0,+ to: 3000,+ },+ {+ name: "Unfold",+ helper: "Reveal your screen with a gentle tilt",+ from: 3000,+ to: 6000,+ },+ {+ name: "Pull back",+ helper: "Pull out to show the bigger picture",+ from: 6000,+ to: DURATION,+ },+] as const;++const WIN_SCALE = 0.85;+const WIN = {+ w: 360 * WIN_SCALE,+ h: 250 * WIN_SCALE,+ left: (CANVAS.w - 360 * WIN_SCALE) / 2,+ top: 30,+} as const;+const S = 1.3;+const ROW = { left: 24, top: 272, gap: 10 } as const;+const ROW_W = (CANVAS.w - ROW.left * 2) / S;+const CARD_W = (ROW_W - ROW.gap * 2) / 3;++type Pose = { ry: number; rx: number; tx: number; s: number };++const poseAt = (t: number): Pose => {+ if (t < 3000) {+ const f = easeInOut(span(t, 0, 3000));+ return { ry: lerp(-16, 16, f), rx: 0, tx: lerp(-26, 26, f), s: 1 };+ }+ if (t < 6000) {+ const f = easeInOut(span(t, 3000, 6000));+ const arc = Math.sin(f * Math.PI);+ return {+ ry: lerp(16, 0, f),+ rx: arc * 24,+ tx: lerp(26, 0, f),+ s: lerp(1, 0.97, arc),+ };+ }+ if (t < 8300) {+ const f = easeInOut(span(t, 6000, 8300));+ return {+ ry: lerp(0, -8, f),+ rx: lerp(0, 9, f),+ tx: lerp(0, -10, f),+ s: lerp(1, 0.8, f),+ };+ }+ const f = easeInOut(span(t, 8300, DURATION));+ return {+ ry: lerp(-8, -16, f),+ rx: lerp(9, 0, f),+ tx: lerp(-10, -26, f),+ s: lerp(0.8, 1, f),+ };+};++const moveAt = (t: number) =>+ MOVES.find((move) => t >= move.from && t < move.to)?.name ?? MOVES[0].name;++export const Visual = ({ playing }: { playing: boolean }) => {+ const groupRef = useRef<HTMLDivElement | null>(null);+ const sideRef = useRef<HTMLDivElement | null>(null);+ const topRef = useRef<HTMLDivElement | null>(null);+ const floorRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState({ move: moveAt(0) });++ useLoop({+ duration: DURATION,+ playing,+ pose: 700,+ tick: (t) => {+ setUi({ move: moveAt(t) });+ const pose = poseAt(t);+ const tilt = Math.min(1, Math.abs(pose.ry) / 24);+ const lean = Math.min(1, Math.abs(pose.rx) / 24);+ if (groupRef.current) {+ groupRef.current.style.transform = `translateX(${pose.tx}px) scale(${pose.s}) rotateY(${pose.ry}deg) rotateX(${pose.rx}deg)`;+ }+ if (sideRef.current) {+ sideRef.current.style.opacity = `${tilt * 0.55}`;+ sideRef.current.style.background =+ pose.ry > 0+ ? "linear-gradient(to right, rgba(9,12,20,0) 35%, rgba(9,12,20,0.8))"+ : "linear-gradient(to left, rgba(9,12,20,0) 35%, rgba(9,12,20,0.8))";+ }+ if (topRef.current) {+ topRef.current.style.opacity = `${lean * 0.5}`;+ }+ if (floorRef.current) {+ floorRef.current.style.transform = `translateX(${pose.tx * 1.15}px) scaleX(${0.7 + pose.s * 0.4}) scaleY(${pose.s})`;+ floorRef.current.style.opacity = `${0.5 + tilt * 0.3}`;+ }+ },+ });++ return (+ <Ground tone="dark">+ <div+ className="pointer-events-none absolute inset-0"+ style={{+ background:+ "radial-gradient(60% 52% at 50% 42%, rgba(99,102,241,0.16), rgba(99,102,241,0) 70%)",+ }}+ />+ <div+ ref={floorRef}+ className="pointer-events-none absolute rounded-full"+ style={{+ left: WIN.left + 30,+ top: WIN.top + WIN.h + 4,+ width: WIN.w - 60,+ height: 30,+ background: `radial-gradient(50% 50% at 50% 50%, ${mix(HUE.threeD, 45, "transparent")}, rgba(99,102,241,0))`,+ filter: "blur(10px)",+ opacity: 0.5,+ }}+ />+ <div+ className="absolute inset-0"+ style={{ perspective: 900, perspectiveOrigin: "50% 42%" }}+ >+ <div+ ref={groupRef}+ className="absolute inset-0 will-change-transform"+ style={{ transformStyle: "preserve-3d" }}+ >+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN_SCALE} />+ <div+ ref={sideRef}+ className="pointer-events-none absolute rounded-[10px]"+ style={{+ left: WIN.left,+ top: WIN.top,+ width: WIN.w,+ height: WIN.h,+ opacity: 0,+ }}+ />+ <div+ ref={topRef}+ className="pointer-events-none absolute rounded-[10px]"+ style={{+ left: WIN.left,+ top: WIN.top,+ width: WIN.w,+ height: WIN.h,+ opacity: 0,+ background:+ "linear-gradient(to bottom, rgba(9,12,20,0.7), rgba(9,12,20,0) 55%)",+ }}+ />+ </div>+ </div>++ <div+ className="absolute flex"+ style={{+ left: ROW.left,+ top: ROW.top,+ width: ROW_W,+ gap: ROW.gap,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ {MOVES.map((move) => {+ const active = ui.move === move.name;+ return (+ <div+ key={move.name}+ className="flex flex-col gap-1 rounded-xl px-3 py-2.5 transition-[box-shadow,background-color] duration-300"+ style={{+ width: CARD_W,+ background: DARK.card,+ boxShadow: active+ ? `inset 0 0 0 1.5px ${DARK.accent}`+ : `inset 0 0 0 1px ${DARK.line}`,+ }}+ >+ <span+ className="whitespace-nowrap text-[12px] font-medium"+ style={{ color: DARK.text1 }}+ >+ {move.name}+ </span>+ <span+ className="text-[10.5px] leading-[1.3]"+ style={{ color: DARK.text2 }}+ >+ {move.helper}+ </span>+ </div>+ );+ })}+ </div>+ </Ground>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cards/zoom.tsx b/apps/web/components/pages/HomeTwo/studio/cards/zoom.tsxnew file mode 100644index 000000000..57c7a9a10--- /dev/null+++ b/apps/web/components/pages/HomeTwo/studio/cards/zoom.tsx@@ -0,0 +1,184 @@+"use client";++import { useRef } from "react";+import { LucideSearch } from "../../demo/capIcons";+import {+ easeInOut,+ span,+ useCursor,+ useSceneState,+ type Way,+} from "../../scenes/engine";+import {+ CANVAS,+ ED,+ Field,+ Ground,+ HUE,+ Lane,+ Panel,+ Playhead,+ RecordedWindow,+ Segment,+ Segmented,+ Slider,+ TRACK_GUTTER,+ TrackLabel,+ useLoop,+} from "../shared";++/* Automatic zoom: a recorded click becomes a zoom segment. The frame zooms+ * into the click point, the Zoom lane fills with the generated segment and+ * the segment's own panel shows the real amount and mode. */++const WIN = { left: 196, top: 18, scale: 1.05 };+const FOCUS = { x: WIN.left + 300 * WIN.scale, y: WIN.top + 74 * WIN.scale };+const FRAME_H = 292;+const CLICK_AT = 1500;+const ZOOM_IN = { start: 1600, end: 2500 };+const ZOOM_OUT = { start: 5200, end: 6100 };+const DURATION = 8000;+const AMOUNT = 1.5;+const PANEL = { left: 16, top: 18, w: 150, scale: 1.15 };++const PATH: Way[] = [+ { t: 0, x: 330, y: 226 },+ { t: 1400, ...FOCUS },+ { t: CLICK_AT, ...FOCUS, click: true },+ { t: 3400, ...FOCUS },+ { t: 4600, x: FOCUS.x - 30, y: FOCUS.y + 44 },+ { t: DURATION, x: FOCUS.x - 30, y: FOCUS.y + 44 },+];++const scaleAt = (t: number) =>+ 1 ++ (AMOUNT - 1) *+ (easeInOut(span(t, ZOOM_IN.start, ZOOM_IN.end)) -+ easeInOut(span(t, ZOOM_OUT.start, ZOOM_OUT.end)));++const S = 1.3;+const LOGICAL = { w: CANVAS.w / S, h: CANVAS.h / S };+const STRIP = { left: 12, top: 226, pad: 8 };+const STRIP_W = LOGICAL.w - STRIP.left * 2;+const LANE_W = STRIP_W - STRIP.pad * 2 - TRACK_GUTTER;+const SEGMENT = { left: 0.16, width: 0.56 };++export const Visual = ({ playing }: { playing: boolean }) => {+ const rootRef = useRef<HTMLDivElement | null>(null);+ const zoomRef = useRef<HTMLDivElement | null>(null);+ const playheadRef = useRef<HTMLDivElement | null>(null);+ const [ui, setUi] = useSceneState({ segment: false });+ const cursor = useCursor(rootRef);++ useLoop({+ duration: DURATION,+ playing,+ pose: 3600,+ tick: (t, seek) => {+ setUi({ segment: t >= CLICK_AT });+ if (zoomRef.current) {+ zoomRef.current.style.transform = `scale(${scaleAt(t)})`;+ }+ if (playheadRef.current) {+ playheadRef.current.style.transform = `translateX(${(t / DURATION) * LANE_W}px)`;+ }+ cursor.tick(PATH, t, seek);+ },+ });++ return (+ <div ref={rootRef} className="relative">+ <Ground tone="light">+ <div+ className="absolute inset-x-0 top-0 overflow-hidden"+ style={{ height: FRAME_H }}+ >+ <div+ ref={zoomRef}+ className="absolute inset-0 will-change-transform"+ style={{ transformOrigin: `${FOCUS.x}px ${FOCUS.y}px` }}+ >+ <RecordedWindow left={WIN.left} top={WIN.top} scale={WIN.scale} />+ </div>+ </div>++ <div+ className="absolute transition-[opacity,transform] duration-300"+ style={{+ left: PANEL.left,+ top: PANEL.top,+ width: PANEL.w,+ transform: `scale(${PANEL.scale}) translateY(${ui.segment ? 0 : 6}px)`,+ transformOrigin: "top left",+ opacity: ui.segment ? 1 : 0,+ }}+ >+ <Panel className="left-0 top-0 w-full gap-3">+ <Field label="Zoom 1" value="1.50x">+ <Slider fill={(AMOUNT - 1) / 3.5} />+ </Field>+ <Field label="Zoom Mode">+ <Segmented options={["Auto", "Manual"]} value="Auto" />+ </Field>+ </Panel>+ </div>++ <div+ className="absolute left-0 top-0"+ style={{+ width: LOGICAL.w,+ height: LOGICAL.h,+ transform: `scale(${S})`,+ transformOrigin: "top left",+ }}+ >+ <div+ className="absolute flex rounded-xl"+ style={{+ left: STRIP.left,+ top: STRIP.top,+ width: STRIP_W,+ padding: STRIP.pad,+ background: ED.card,+ boxShadow: ED.cardShadow,+ }}+ >+ <TrackLabel+ hue={HUE.zoom}+ icon={<LucideSearch className="size-3.5" />}+ >+ Zoom+ </TrackLabel>+ <Lane+ empty={+ ui.segment ? undefined : (+ <>+ <span>Generate zoom segments automatically</span>+ <span style={{ color: ED.text2 }}>· Generate</span>+ </>+ )+ }+ >+ <Segment+ hue={HUE.zoom}+ label="Automatic Zoom"+ sublabel="1.5x"+ selected+ className="transition-[opacity,transform] duration-300"+ style={{+ left: `${SEGMENT.left * 100}%`,+ width: `${SEGMENT.width * 100}%`,+ opacity: ui.segment ? 1 : 0,+ transform: ui.segment ? "scaleX(1)" : "scaleX(0.6)",+ transformOrigin: "left center",+ }}+ />+ <Playhead playheadRef={playheadRef} top={-6} bottom={0} />+ </Lane>+ </div>+ </div>+ {cursor.Cursor}+ </Ground>+ </div>+ );+};diff --git a/apps/web/components/pages/HomeTwo/studio/cardsA.tsx b/apps/web/components/pages/HomeTwo/studio/cardsA.tsxdeleted file mode 100644index a6571e326..000000000--- a/apps/web/components/pages/HomeTwo/studio/cardsA.tsx+++ /dev/null@@ -1,795 +0,0 @@-"use client";--import { classNames } from "@cap/utils/helpers";-import { useRef } from "react";-import { ContentWindow } from "../demo/MacDesktop";-import { useVideoAttrs, VIDEO_POSTERS } from "../demo/media";-import {- easeInOut,- easeOut,- lerp,- restartAnimation,- SCENE_CSS,- span,- typed,- useCursor,- useSceneState,- useVideo,- type Way,-} from "../scenes/engine";-import {- CameraBubble,- CanvasStage,- Chip,- RECORDED,- RecordedWindow,- useLoop,-} from "./shared";--const MASK_DURATION = 8200;-const MASK = { x: RECORDED.left + 72, y: RECORDED.top + 112, w: 268, h: 52 };-const MASK_DRAG = { start: 600, end: 1700 };-const MASK_BLUR = 1900;-const MASK_PIXELATE = 3600;-const MASK_HIGHLIGHT = 5400;-const MASK_CONTROL = { x: MASK.x, y: MASK.y + MASK.h + 14 };-const MASK_MODES = ["Blur", "Pixelate", "Highlight"] as const;-const SEGMENT_W = 74;--const MASK_PATH: Way[] = [- { t: 0, x: MASK.x - 36, y: MASK.y - 26 },- { t: MASK_DRAG.start, x: MASK.x, y: MASK.y },- { t: MASK_DRAG.end, x: MASK.x + MASK.w, y: MASK.y + MASK.h },- { t: MASK_BLUR, x: MASK.x + MASK.w, y: MASK.y + MASK.h },- { t: 3400, x: MASK_CONTROL.x + SEGMENT_W * 1.5, y: MASK_CONTROL.y + 14 },- {- t: MASK_PIXELATE,- x: MASK_CONTROL.x + SEGMENT_W * 1.5,- y: MASK_CONTROL.y + 14,- click: true,- },- { t: 5200, x: MASK_CONTROL.x + SEGMENT_W * 2.5, y: MASK_CONTROL.y + 14 },- {- t: MASK_HIGHLIGHT,- x: MASK_CONTROL.x + SEGMENT_W * 2.5,- y: MASK_CONTROL.y + 14,- click: true,- },- { t: 6600, x: MASK.x + MASK.w + 60, y: MASK.y + MASK.h + 90 },- { t: MASK_DURATION, x: MASK.x + MASK.w + 60, y: MASK.y + MASK.h + 90 },-];--const PIXELS = Array.from({ length: 22 * 4 }, (_, i) => {- const seed = Math.sin(i * 12.9898 + 4.1414) * 43758.5453;- const v = seed - Math.floor(seed);- const l = 62 + Math.floor(v * 30);- return `hsl(216 22% ${l}%)`;-});--const maskUiAt = (t: number) => ({- drawing: t >= MASK_DRAG.start && t < MASK_BLUR,- mode:- t >= MASK_HIGHLIGHT- ? "Highlight"- : t >= MASK_PIXELATE- ? "Pixelate"- : t >= MASK_BLUR- ? "Blur"- : null,-});--export const BlurVisual = ({ playing }: { playing: boolean }) => {- const rootRef = useRef<HTMLDivElement | null>(null);- const boxRef = useRef<HTMLDivElement | null>(null);- const [ui, setUi] = useSceneState(maskUiAt(0));- const cursor = useCursor(rootRef);-- useLoop({- duration: MASK_DURATION,- playing,- pose: 4400,- tick: (t, seek) => {- setUi(maskUiAt(t));- const drag = easeOut(span(t, MASK_DRAG.start, MASK_DRAG.end));- if (boxRef.current) {- boxRef.current.style.width = `${lerp(0, MASK.w, drag)}px`;- boxRef.current.style.height = `${lerp(0, MASK.h, drag)}px`;- boxRef.current.style.opacity = t >= MASK_DRAG.start ? "1" : "0";- }- cursor.tick(MASK_PATH, t, seek);- },- });-- const applied = ui.mode !== null;- const highlight = ui.mode === "Highlight";-- return (- <div ref={rootRef} className="relative">- <CanvasStage>- <RecordedWindow />- <CameraBubble playing={playing} />-- <div- ref={boxRef}- className="pointer-events-none absolute z-20 overflow-hidden rounded-[6px]"- style={{- left: MASK.x,- top: MASK.y,- width: 0,- height: 0,- opacity: 0,- border: applied- ? "2px solid #0090ff"- : "2px dashed rgba(255,255,255,0.95)",- boxShadow: highlight- ? "0 0 0 9999px rgba(9,12,20,0.55)"- : applied- ? "0 0 0 1px rgba(255,255,255,0.7)"- : "0 0 0 1px rgba(0,144,255,0.9), 0 0 0 9999px rgba(9,12,20,0.18)",- transition: "box-shadow 420ms ease, border-color 200ms ease",- }}- >- <div- className="absolute inset-0 transition-opacity duration-300"- style={{- opacity: ui.mode === "Blur" ? 1 : 0,- backdropFilter: "blur(9px) saturate(1.2)",- WebkitBackdropFilter: "blur(9px) saturate(1.2)",- background: "rgba(236,240,246,0.35)",- }}- />- <div- className="absolute inset-0 grid transition-opacity duration-300"- style={{- opacity: ui.mode === "Pixelate" ? 1 : 0,- gridTemplateColumns: "repeat(22, 1fr)",- gridTemplateRows: "repeat(4, 1fr)",- }}- >- {PIXELS.map((color, i) => (- <span key={`${i}-${color}`} style={{ background: color }} />- ))}- </div>- </div>-- {[- { left: MASK.x - 5, top: MASK.y - 5 },- { left: MASK.x + MASK.w - 5, top: MASK.y - 5 },- { left: MASK.x - 5, top: MASK.y + MASK.h - 5 },- { left: MASK.x + MASK.w - 5, top: MASK.y + MASK.h - 5 },- ].map((handle) => (- <span- key={`${handle.left}-${handle.top}`}- className="pointer-events-none absolute z-30 size-[10px] rounded-full border-2 border-[#0090ff] bg-white transition-opacity duration-300"- style={{ ...handle, opacity: applied ? 1 : 0 }}- />- ))}-- <div- className="absolute z-30 flex rounded-lg p-1 transition-[opacity,transform] duration-300"- style={{- left: MASK_CONTROL.x,- top: MASK_CONTROL.y,- background: "#fcfcfc",- border: "1px solid rgba(0,0,0,0.08)",- boxShadow: "0 10px 24px -12px rgba(16,24,40,0.5)",- opacity: applied ? 1 : 0,- transform: applied ? "translateY(0)" : "translateY(6px)",- }}- >- {MASK_MODES.map((mode) => (- <span- key={mode}- className={classNames(- "flex h-7 items-center justify-center rounded-md text-[12px] font-medium transition-colors duration-200",- ui.mode === mode- ? "bg-[#111111] text-white"- : "text-[rgba(17,17,17,0.6)]",- )}- style={{ width: SEGMENT_W }}- >- {mode}- </span>- ))}- </div>- {cursor.Cursor}- </CanvasStage>- </div>- );-};--const TRACK = { top: 328, height: 36, left: 96, right: 584 } as const;--const TrackStrip = ({- label,- children,- playhead,-}: {- label: string;- children: React.ReactNode;- playhead: React.RefObject<HTMLDivElement | null>;-}) => (- <div- className="absolute inset-x-4 z-30 flex items-stretch gap-2"- style={{ top: TRACK.top, height: TRACK.height }}- >- <span- className="flex w-[72px] shrink-0 items-center justify-center rounded-lg text-[11px] font-medium text-white"- style={{ background: "#4a4f5c", border: "1px solid #30343d" }}- >- {label}- </span>- <div- className="relative flex-1 overflow-hidden rounded-lg"- style={{ background: "rgba(252,252,252,0.55)" }}- >- {children}- <div- ref={playhead}- className="pointer-events-none absolute inset-y-0 left-0 w-px"- style={{ background: "rgb(226,64,64)" }}- >- <span- className="absolute -left-[4.5px] -top-[1px] size-[10px] rounded-full"- style={{ background: "rgb(226,64,64)" }}- />- </div>- </div>- </div>-);--const CameraPane = ({- playing,- style,- className,-}: {- playing: boolean;- style?: React.CSSProperties;- className?: string;-}) => {- const ref = useRef<HTMLVideoElement | null>(null);- const attrs = useVideoAttrs(VIDEO_POSTERS.webcam);- useVideo(playing, ref);- return (- <div- className={classNames("absolute overflow-hidden bg-[#111111]", className)}- style={style}- >- <video- ref={ref}- className="h-full w-full object-cover"- src="/videos/home-two/webcam.mp4"- muted- loop- playsInline- {...attrs}- />- </div>- );-};--const SCENES_DURATION = 12000;-const SCENE_MODES = [- { key: "default", label: "Default" },- { key: "cameraOnly", label: "Camera only" },- { key: "splitScreen", label: "Split screen" },- { key: "floating", label: "Floating" },-] as const;-type SceneKey = (typeof SCENE_MODES)[number]["key"];-const SCENE_SLOT = SCENES_DURATION / SCENE_MODES.length;-const SCENE_SCREEN = { w: 360, h: 250 } as const;--const SCENE_LAYOUT: Record<- SceneKey,- {- screen: {- left: number;- top: number;- w: number;- h: number;- shift: number;- scale: number;- radius: number;- opacity: number;- };- camera: {- left: number;- top: number;- w: number;- h: number;- radius: number;- opacity: number;- };- }-> = {- default: {- screen: {- left: 120,- top: 30,- w: 360,- h: 250,- shift: 0,- scale: 1,- radius: 10,- opacity: 1,- },- camera: { left: 28, top: 222, w: 88, h: 88, radius: 44, opacity: 1 },- },- cameraOnly: {- screen: {- left: 120,- top: 30,- w: 360,- h: 250,- shift: 0,- scale: 1,- radius: 10,- opacity: 0,- },- camera: { left: 120, top: 30, w: 360, h: 250, radius: 12, opacity: 1 },- },- splitScreen: {- screen: {- left: 24,- top: 30,- w: 272,- h: 250,- shift: -6,- scale: 1,- radius: 12,- opacity: 1,- },- camera: { left: 304, top: 30, w: 272, h: 250, radius: 12, opacity: 1 },- },- floating: {- screen: {- left: 52,- top: 40,- w: 320,- h: 222,- shift: 0,- scale: 320 / 360,- radius: 14,- opacity: 1,- },- camera: { left: 396, top: 84, w: 160, h: 160, radius: 18, opacity: 1 },- },-};--const SCENE_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";-const sceneTransition = `left 480ms ${SCENE_EASE}, top 480ms ${SCENE_EASE}, width 480ms ${SCENE_EASE}, height 480ms ${SCENE_EASE}, border-radius 480ms ${SCENE_EASE}, opacity 320ms ease, transform 480ms ${SCENE_EASE}`;--const sceneAt = (t: number): SceneKey =>- SCENE_MODES[Math.min(SCENE_MODES.length - 1, Math.floor(t / SCENE_SLOT))]- ?.key ?? "default";--export const ScenesVisual = ({ playing }: { playing: boolean }) => {- const playheadRef = useRef<HTMLDivElement | null>(null);- const [scene, setScene] = useSceneState<SceneKey>("default");- const scrollRef = useRef<HTMLDivElement | null>(null);-- useLoop({- duration: SCENES_DURATION,- playing,- pose: 7000,- tick: (t) => {- setScene(sceneAt(t));- if (playheadRef.current) {- playheadRef.current.style.left = `${(t / SCENES_DURATION) * 100}%`;- }- },- });-- const layout = SCENE_LAYOUT[scene];-- return (- <CanvasStage wallpaper="/backgrounds/sf.webp">- <div- className="absolute overflow-hidden"- style={{- left: layout.screen.left,- top: layout.screen.top,- width: layout.screen.w,- height: layout.screen.h,- borderRadius: layout.screen.radius,- opacity: layout.screen.opacity,- transform: layout.screen.opacity ? "scale(1)" : "scale(0.94)",- boxShadow: "0 22px 60px rgba(0,0,0,0.28)",- transition: sceneTransition,- }}- >- <div- className="absolute left-0 top-0"- style={{- width: SCENE_SCREEN.w,- height: SCENE_SCREEN.h,- transform: `translateX(${layout.screen.shift}px) scale(${layout.screen.scale})`,- transformOrigin: "top left",- transition: `transform 480ms ${SCENE_EASE}`,- }}- >- <ContentWindow- width={SCENE_SCREEN.w}- height={SCENE_SCREEN.h}- scrollRef={scrollRef}- />- </div>- </div>- <CameraPane- playing={playing}- style={{- left: layout.camera.left,- top: layout.camera.top,- width: layout.camera.w,- height: layout.camera.h,- borderRadius: layout.camera.radius,- opacity: layout.camera.opacity,- boxShadow: "0 14px 34px rgba(0,0,0,0.32)",- transition: sceneTransition,- }}- />- <TrackStrip label="Scene" playhead={playheadRef}>- {SCENE_MODES.map((mode, i) => (- <span- key={mode.key}- className="absolute inset-y-1 flex items-center justify-center rounded-md text-[11px] font-medium text-white transition-[background-color,opacity] duration-300"- style={{- left: `calc(${(i / SCENE_MODES.length) * 100}% + 3px)`,- width: `calc(${100 / SCENE_MODES.length}% - 6px)`,- background: scene === mode.key ? "#7B5FD0" : "#B9A5F2",- border: "1px solid rgba(123,95,208,0.5)",- }}- >- {mode.label}- </span>- ))}- </TrackStrip>- </CanvasStage>- );-};--const TEXT_DURATION = 10000;-const LOWER = { enter: 400, exit: 2900 };-const STAT = { enter: 3700, exit: 6100 };-const TYPE = { enter: 6600, exit: 9400 };-const TYPEWRITER_TEXT = "Try the new flow →";--const textPresetAt = (t: number) =>- t >= TYPE.enter - 100 && t < TYPE.exit + 300- ? "Typewriter · Typewriter"- : t >= STAT.enter - 100 && t < STAT.exit + 300- ? "Big Stat · Pop"- : t >= LOWER.enter - 100 && t < LOWER.exit + 300- ? "Lower Third · Slide up"- : null;--export const TextVisual = ({ playing }: { playing: boolean }) => {- const lowerRef = useRef<HTMLDivElement | null>(null);- const statRef = useRef<HTMLDivElement | null>(null);- const typeRef = useRef<HTMLDivElement | null>(null);- const typeTextRef = useRef<HTMLSpanElement | null>(null);- const [preset, setPreset] = useSceneState<string | null>(null);- const lastPreset = useRef("Lower Third · Slide up");- if (preset) lastPreset.current = preset;-- useLoop({- duration: TEXT_DURATION,- playing,- pose: 4800,- tick: (t) => {- setPreset(textPresetAt(t));- if (lowerRef.current) {- const inF = easeOut(span(t, LOWER.enter, LOWER.enter + 480));- const outF = easeOut(span(t, LOWER.exit, LOWER.exit + 360));- lowerRef.current.style.opacity = `${inF * (1 - outF)}`;- lowerRef.current.style.transform = `translateY(${lerp(26, 0, inF) + outF * 18}px)`;- }- if (statRef.current) {- const inF = span(t, STAT.enter, STAT.enter + 520);- const overshoot = 1 + Math.sin(inF * Math.PI) * 0.12;- const outF = easeOut(span(t, STAT.exit, STAT.exit + 320));- statRef.current.style.opacity = `${easeOut(inF) * (1 - outF)}`;- statRef.current.style.transform = `translateX(-50%) scale(${lerp(0.6, 1, easeOut(inF)) * overshoot})`;- }- if (typeRef.current && typeTextRef.current) {- const outF = easeOut(span(t, TYPE.exit, TYPE.exit + 300));- typeRef.current.style.opacity = `${t >= TYPE.enter ? 1 - outF : 0}`;- typeTextRef.current.textContent =- t >= TYPE.enter- ? typed(TYPEWRITER_TEXT, t, TYPE.enter + 200, 22)- : "";- }- },- });-- return (- <CanvasStage wallpaper="/backgrounds/nyc.webp">- <RecordedWindow />- <CameraBubble playing={playing} />-- <div- ref={lowerRef}- className="absolute z-20 flex items-stretch gap-3 opacity-0"- style={{ left: 136, top: 318 }}- >- <span className="w-[3px] rounded-full bg-[#8FC1F7]" />- <span className="leading-tight [text-shadow:0_2px_12px_rgba(0,0,0,0.45)]">- <span className="block text-[18px] font-semibold text-white">- Sofia Chen- </span>- <span className="block text-[12.5px] font-medium text-white/80">- Head of Product- </span>- </span>- </div>-- <div- ref={statRef}- className="absolute left-1/2 z-20 flex -translate-x-1/2 flex-col items-center rounded-2xl px-8 py-4 opacity-0"- style={{- top: 104,- background: "rgba(17,17,17,0.72)",- boxShadow: "0 18px 40px -16px rgba(0,0,0,0.6)",- }}- >- <span className="text-[64px] font-semibold leading-none tracking-[-0.04em] text-white [text-shadow:0_6px_30px_rgba(0,0,0,0.45)]">- 3.2×- </span>- <span className="mt-2 text-[13px] font-medium uppercase tracking-[0.08em] text-white/85 [text-shadow:0_2px_10px_rgba(0,0,0,0.45)]">- faster onboarding- </span>- </div>-- <div- ref={typeRef}- className="absolute z-20 rounded-lg px-3 py-2 text-[14px] font-medium text-white opacity-0"- style={{ right: 32, top: 40, background: "rgba(17,17,17,0.8)" }}- >- <span ref={typeTextRef} />- <span className="ml-0.5 inline-block h-[14px] w-[1.5px] translate-y-[2px] animate-pulse bg-white/85" />- </div>-- <div- className="absolute left-4 top-4 z-30 transition-opacity duration-300"- style={{ opacity: preset ? 1 : 0 }}- >- <Chip>{preset ?? lastPreset.current}</Chip>- </div>- </CanvasStage>- );-};--const ZOOM_DURATION = 8000;-const ZOOM_FOCUS = { x: 420, y: 104 };-const ZOOM_CLICK = 1500;-const ZOOM_IN = { start: 1600, end: 2600 };-const ZOOM_OUT = { start: 5200, end: 6200 };-const ZOOM_PATH: Way[] = [- { t: 0, x: 300, y: 230 },- { t: 1400, x: ZOOM_FOCUS.x, y: ZOOM_FOCUS.y },- { t: ZOOM_CLICK, x: ZOOM_FOCUS.x, y: ZOOM_FOCUS.y, click: true },- { t: 3200, x: ZOOM_FOCUS.x, y: ZOOM_FOCUS.y },- { t: 4600, x: ZOOM_FOCUS.x + 26, y: ZOOM_FOCUS.y + 34 },- { t: ZOOM_DURATION, x: ZOOM_FOCUS.x + 26, y: ZOOM_FOCUS.y + 34 },-];--const zoomScaleAt = (t: number) =>- 1 +- easeInOut(span(t, ZOOM_IN.start, ZOOM_IN.end)) -- easeInOut(span(t, ZOOM_OUT.start, ZOOM_OUT.end));--export const ZoomVisual = ({ playing }: { playing: boolean }) => {- const rootRef = useRef<HTMLDivElement | null>(null);- const zoomRef = useRef<HTMLDivElement | null>(null);- const ringRef = useRef<HTMLSpanElement | null>(null);- const playheadRef = useRef<HTMLDivElement | null>(null);- const clickRef = useRef(-1);- const [ui, setUi] = useSceneState({ segment: false });- const cursor = useCursor(rootRef);-- useLoop({- duration: ZOOM_DURATION,- playing,- pose: 3600,- tick: (t, seek) => {- setUi({ segment: t >= ZOOM_CLICK });- if (zoomRef.current) {- zoomRef.current.style.transform = `scale(${zoomScaleAt(t)})`;- }- if (playheadRef.current) {- playheadRef.current.style.left = `${(t / ZOOM_DURATION) * 100}%`;- }- if (seek) clickRef.current = t - 1;- if (clickRef.current < ZOOM_CLICK && t >= ZOOM_CLICK) {- restartAnimation(ringRef.current, "ht-scene-ripple 700ms ease-out");- }- clickRef.current = t;- cursor.tick(ZOOM_PATH, t, seek);- },- });-- return (- <div ref={rootRef} className="relative">- <CanvasStage wallpaper="/backgrounds/london.webp">- <style>{SCENE_CSS}</style>- <div- ref={zoomRef}- className="absolute inset-0 will-change-transform"- style={{ transformOrigin: `${ZOOM_FOCUS.x}px ${ZOOM_FOCUS.y}px` }}- >- <RecordedWindow top={30} />- <CameraBubble playing={playing} size={88} left={28} top={222} />- <span- ref={ringRef}- className="pointer-events-none absolute size-9 -translate-x-1/2 -translate-y-1/2 rounded-full opacity-0"- style={{- left: ZOOM_FOCUS.x,- top: ZOOM_FOCUS.y,- border: "2px solid rgba(0,144,255,0.9)",- }}- />- <span- className="pointer-events-none absolute size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-[#0090ff] transition-opacity duration-300"- style={{- left: ZOOM_FOCUS.x,- top: ZOOM_FOCUS.y,- opacity: ui.segment ? 1 : 0,- boxShadow: "0 0 0 3px rgba(0,144,255,0.25)",- }}- />- </div>- <TrackStrip label="Zoom" playhead={playheadRef}>- <span- className="absolute inset-y-1 flex items-center justify-center rounded-md text-[11px] font-medium text-white transition-opacity duration-300"- style={{- left: `${(ZOOM_CLICK / ZOOM_DURATION) * 100}%`,- width: `${((ZOOM_OUT.end - ZOOM_CLICK) / ZOOM_DURATION) * 100}%`,- background: "#4a4f5c",- border: "1px solid #30343d",- opacity: ui.segment ? 1 : 0,- }}- >- 2×- </span>- </TrackStrip>- {cursor.Cursor}- </CanvasStage>- </div>- );-};--const CAPTIONS_DURATION = 9000;-const CAPTION_LINES = [- {- start: 600,- words: "So this is the new dashboard we’re shipping".split(" "),- },- { start: 4400, words: "Every card here pulls live data".split(" ") },-];-const WORD_MS = 380;-const CAPTION_CLOCK_BASE = 4;-const BURN_TOGGLE = { x: 548, y: 30 };-const BURN_AT = 7600;-const CAPTION_PATH: Way[] = [- { t: 0, x: 470, y: 250 },- { t: 6600, x: 470, y: 250 },- { t: 7400, x: BURN_TOGGLE.x, y: BURN_TOGGLE.y },- { t: BURN_AT, x: BURN_TOGGLE.x, y: BURN_TOGGLE.y, click: true },- { t: 8400, x: BURN_TOGGLE.x - 60, y: BURN_TOGGLE.y + 70 },- { t: CAPTIONS_DURATION, x: BURN_TOGGLE.x - 60, y: BURN_TOGGLE.y + 70 },-];--const captionAt = (t: number) => {- let line = 0;- for (let i = 0; i < CAPTION_LINES.length; i++) {- if (t >= (CAPTION_LINES[i]?.start ?? 0)) line = i;- }- const current = CAPTION_LINES[line];- const elapsed = t - (current?.start ?? 0);- const active = Math.min(- (current?.words.length ?? 1) - 1,- Math.floor(Math.max(0, elapsed) / WORD_MS),- );- return {- line,- active,- shown: t >= (CAPTION_LINES[0]?.start ?? 0),- burn: t >= BURN_AT,- };-};--export const CaptionsVisual = ({ playing }: { playing: boolean }) => {- const rootRef = useRef<HTMLDivElement | null>(null);- const clockRef = useRef<HTMLSpanElement | null>(null);- const [ui, setUi] = useSceneState(captionAt(0));- const cursor = useCursor(rootRef);-- useLoop({- duration: CAPTIONS_DURATION,- playing,- pose: 2200,- tick: (t, seek) => {- setUi(captionAt(t));- if (clockRef.current) {- const seconds =- CAPTION_CLOCK_BASE + Math.floor(Math.max(0, t - 600) / 1000);- clockRef.current.textContent = `0:${String(seconds).padStart(2, "0")}`;- }- cursor.tick(CAPTION_PATH, t, seek);- },- });-- const line = CAPTION_LINES[ui.line] ?? CAPTION_LINES[0];-- return (- <div ref={rootRef} className="relative">- <CanvasStage wallpaper="/backgrounds/rome.webp">- <RecordedWindow top={22} />- <CameraBubble playing={playing} size={88} left={28} top={222} />-- <div className="absolute left-4 top-4 z-30">- <Chip>- <span className="size-2 rounded-full bg-[#0f7a58]" />- English · Whisper- </Chip>- </div>-- <div- className="absolute z-30 flex h-8 items-center gap-2 rounded-lg pl-2.5 pr-1.5 text-[12px] font-medium"- style={{- right: 16,- top: 16,- background: "#fcfcfc",- color: "#202020",- border: "1px solid rgba(0,0,0,0.08)",- boxShadow: "0 8px 20px -10px rgba(16,24,40,0.45)",- }}- >- Burn in- <span- className="relative inline-flex h-5 w-[34px] rounded-full transition-colors duration-200"- style={{ background: ui.burn ? "#0090ff" : "#e0e0e0" }}- >- <span- className="absolute top-[2px] size-4 rounded-full bg-white shadow-sm transition-[left] duration-200"- style={{ left: ui.burn ? 16 : 2 }}- />- </span>- </div>-- <div- className="absolute bottom-[22px] left-1/2 z-20 flex max-w-[540px] -translate-x-1/2 items-center justify-center gap-x-1 whitespace-nowrap rounded-xl px-4 py-2 transition-opacity duration-300"- style={{- background: "rgba(17,17,17,0.74)",- opacity: ui.shown ? 1 : 0,- }}- >- {line?.words.map((word, i) => (- <span- key={`${ui.line}-${word}-${i}`}- className={classNames(- "rounded-md px-1.5 py-1 text-[16px] font-medium leading-none transition-colors duration-150",- i === ui.active ? "bg-[#0090ff] text-white" : "text-white/92",- )}- >- {word}- </span>- ))}- </div>- <span- ref={clockRef}- className="absolute z-20 rounded-md px-1.5 py-0.5 text-[11px] font-medium tabular-nums text-white/85 transition-opacity duration-300"- style={{- right: 16,- bottom: 26,- background: "rgba(17,17,17,0.6)",- opacity: ui.shown ? 1 : 0,- }}- >- 0:04- </span>- {cursor.Cursor}- </CanvasStage>- </div>- );-};diff --git a/apps/web/components/pages/HomeTwo/studio/cardsB.tsx b/apps/web/components/pages/HomeTwo/studio/cardsB.tsxdeleted file mode 100644index 9a9a2a3b2..000000000--- a/apps/web/components/pages/HomeTwo/studio/cardsB.tsx+++ /dev/null@@ -1,843 +0,0 @@-"use client";--import { classNames } from "@cap/utils/helpers";-import Image from "next/image";-import { useRef } from "react";-import {- easeInOut,- lerp,- span,- useCursor,- useSceneState,- type Way,-} from "../scenes/engine";-import {- CANVAS,- CameraBubble,- CanvasStage,- Chip,- RECORDED,- RecordedWindow,- useLoop,-} from "./shared";--const THREE_D_DURATION = 9000;--const threeDPoseAt = (t: number) => {- if (t < 3000) {- const f = easeInOut(span(t, 0, 3000));- return {- ry: lerp(-14, 14, f),- rx: 0,- tx: lerp(-28, 28, f),- s: 1,- label: "Glide across",- };- }- if (t < 6000) {- const f = easeInOut(span(t, 3000, 6000));- return {- ry: lerp(14, 0, f),- rx: lerp(0, 10, f),- tx: lerp(28, 0, f),- s: lerp(1, 0.86, f),- label: "Pull back",- };- }- if (t < 7500) {- const f = easeInOut(span(t, 6000, 7500));- return {- ry: lerp(0, -24, f),- rx: lerp(10, 6, f),- tx: lerp(0, -10, f),- s: lerp(0.86, 1, f),- label: "Tilt away",- };- }- const f = easeInOut(span(t, 7500, THREE_D_DURATION));- return {- ry: lerp(-24, -14, f),- rx: lerp(6, 0, f),- tx: lerp(-10, -28, f),- s: 1,- label: "Tilt away",- };-};--export const ThreeDVisual = ({ playing }: { playing: boolean }) => {- const groupRef = useRef<HTMLDivElement | null>(null);- const depthRef = useRef<HTMLDivElement | null>(null);- const vignetteRef = useRef<HTMLDivElement | null>(null);- const floorRef = useRef<HTMLDivElement | null>(null);- const [ui, setUi] = useSceneState({ label: "Glide across" });-- useLoop({- duration: THREE_D_DURATION,- playing,- pose: 6900,- tick: (t) => {- const pose = threeDPoseAt(t);- setUi({ label: pose.label });- const tilt = Math.min(1, Math.abs(pose.ry) / 24);- if (groupRef.current) {- groupRef.current.style.transform = `translateX(${pose.tx}px) scale(${pose.s}) rotateY(${pose.ry}deg) rotateX(${pose.rx}deg)`;- }- if (depthRef.current) {- depthRef.current.style.opacity = `${tilt * 0.55}`;- depthRef.current.style.background =- pose.ry > 0- ? "linear-gradient(to right, rgba(9,12,20,0) 35%, rgba(9,12,20,0.75))"- : "linear-gradient(to left, rgba(9,12,20,0) 35%, rgba(9,12,20,0.75))";- }- if (vignetteRef.current) {- vignetteRef.current.style.opacity = `${0.18 + tilt * 0.4}`;- }- if (floorRef.current) {- floorRef.current.style.transform = `translateX(${pose.tx * 1.15}px) scaleX(${0.7 + pose.s * 0.4}) scaleY(${pose.s})`;- floorRef.current.style.opacity = `${0.35 + tilt * 0.3}`;- }- },- });-- return (- <CanvasStage wallpaper="/backgrounds/rome.webp">- <div- ref={vignetteRef}- className="pointer-events-none absolute inset-0 z-0"- style={{- background:- "radial-gradient(80% 70% at 50% 50%, rgba(9,12,20,0) 45%, rgba(9,12,20,0.7) 100%)",- opacity: 0.18,- }}- />- <div- ref={floorRef}- className="pointer-events-none absolute z-0 rounded-full"- style={{- left: RECORDED.left + 30,- top: RECORDED.top + RECORDED.height + 8,- width: RECORDED.width - 60,- height: 26,- background:- "radial-gradient(50% 50% at 50% 50%, rgba(9,12,20,0.55), rgba(9,12,20,0))",- filter: "blur(6px)",- opacity: 0.35,- }}- />- <div- className="absolute inset-0 z-10"- style={{ perspective: 900, perspectiveOrigin: "50% 45%" }}- >- <div- ref={groupRef}- className="absolute inset-0 will-change-transform"- style={{ transformStyle: "preserve-3d" }}- >- <RecordedWindow />- <CameraBubble- playing={playing}- size={84}- left={RECORDED.left - 36}- top={RECORDED.top + RECORDED.height - 60}- />- <div- ref={depthRef}- className="pointer-events-none absolute rounded-[10px]"- style={{- left: RECORDED.left,- top: RECORDED.top,- width: RECORDED.width,- height: RECORDED.height,- opacity: 0,- }}- />- </div>- </div>- <div className="absolute left-4 top-4 z-20 flex items-center gap-2">- <Chip>- <span- className="size-2 rounded-full"- style={{ background: "#7B5FD0" }}- />- 3D camera- </Chip>- <Chip style={{ color: "rgba(17,17,17,0.6)" }}>{ui.label}</Chip>- </div>- </CanvasStage>- );-};--const CANVAS_DURATION = 10000;-const WALLS = [- "/backgrounds/monaco.webp",- "/backgrounds/santorini.webp",- "/backgrounds/nyc.webp",-];-type FrameKind = "none" | "browser" | "macbook";--const canvasUiAt = (t: number) => ({- wall: t < 2500 ? 0 : t < 5000 ? 1 : 2,- frame: (t < 5000- ? "none"- : t < 7600- ? "browser"- : t < 9500- ? "macbook"- : "none") as FrameKind,-});--const FRAME_LABEL: Record<FrameKind, string> = {- none: "Frame · None",- browser: "Frame · Browser",- macbook: "Frame · MacBook",-};--const canvasScaleAt = (t: number) => {- const grow = easeInOut(span(t, 2500, 3500));- const back = easeInOut(span(t, 9500, CANVAS_DURATION));- const s = lerp(lerp(1, 0.9, grow), 1, back);- const r = lerp(lerp(10, 20, grow), 10, back);- return { s, r };-};--export const CanvasVisual = ({ playing }: { playing: boolean }) => {- const groupRef = useRef<HTMLDivElement | null>(null);- const clipRef = useRef<HTMLDivElement | null>(null);- const [ui, setUi] = useSceneState(canvasUiAt(0));-- useLoop({- duration: CANVAS_DURATION,- playing,- pose: 6400,- tick: (t) => {- setUi(canvasUiAt(t));- const { s, r } = canvasScaleAt(t);- if (groupRef.current) groupRef.current.style.transform = `scale(${s})`;- if (clipRef.current) clipRef.current.style.borderRadius = `${r}px`;- },- });-- const browser = ui.frame === "browser";- const macbook = ui.frame === "macbook";-- return (- <CanvasStage wallpaper={WALLS[0]}>- {WALLS.slice(1).map((wall, i) => (- <Image- key={wall}- src={wall}- alt=""- fill- sizes="600px"- draggable={false}- className="object-cover transition-opacity duration-700"- style={{ opacity: ui.wall >= i + 1 ? 1 : 0 }}- />- ))}- <div- ref={groupRef}- className="absolute will-change-transform"- style={{- left: RECORDED.left,- top: RECORDED.top,- width: RECORDED.width,- height: RECORDED.height,- transformOrigin: "50% 55%",- }}- >- <div- className="pointer-events-none absolute transition-[opacity,transform] duration-500"- style={{- left: -14,- top: -14,- right: -14,- bottom: -14,- borderRadius: 22,- background: "linear-gradient(180deg, #2b2d33 0%, #101114 12%)",- boxShadow:- "inset 0 0 0 1px rgba(255,255,255,0.08), 0 30px 60px -30px rgba(9,12,20,0.7)",- opacity: macbook ? 1 : 0,- transform: macbook ? "scale(1)" : "scale(1.04)",- }}- />- <div- className="pointer-events-none absolute transition-opacity duration-500"- style={{- left: -48,- right: -48,- bottom: -26,- height: 12,- borderRadius: "0 0 14px 14px",- background: "linear-gradient(180deg, #d7d9de, #9a9ea6)",- boxShadow: "0 14px 30px -12px rgba(9,12,20,0.6)",- opacity: macbook ? 1 : 0,- }}- />- <div- className="pointer-events-none absolute inset-x-0 flex items-center gap-2 px-3 transition-[opacity,transform] duration-500"- style={{- top: -34,- height: 36,- borderRadius: "10px 10px 0 0",- background: "#f6f7f9",- border: "1px solid rgba(0,0,0,0.08)",- borderBottom: "none",- opacity: browser ? 1 : 0,- transform: browser ? "translateY(0)" : "translateY(10px)",- }}- >- <span className="flex items-center gap-1.5">- {["#FF5F57", "#FEBC2E", "#28C840"].map((color) => (- <span- key={color}- className="size-[9px] rounded-full"- style={{ background: color }}- />- ))}- </span>- <span- className="ml-1 flex h-6 items-center rounded-t-md px-3 text-[10.5px] font-medium"- style={{ background: "#ffffff", color: "#202020" }}- >- Dashboard- </span>- <span- className="ml-auto flex h-5 w-[46%] items-center justify-center rounded-md text-[10px]"- style={{- background: "rgba(17,17,17,0.06)",- color: "rgba(17,17,17,0.6)",- }}- >- acme.com/dashboard- </span>- </div>- <div- ref={clipRef}- className="absolute inset-0 overflow-hidden transition-[border-radius] duration-500"- style={{- borderRadius: 10,- boxShadow: "0 24px 50px -20px rgba(9,12,20,0.6)",- }}- >- <div- className="absolute inset-x-0 transition-[top] duration-500"- style={{ top: browser ? -40 : 0 }}- >- <RecordedWindow left={0} top={0} />- </div>- </div>- </div>- <CameraBubble playing={playing} />- <div className="absolute left-4 top-4 z-20 flex gap-2">- <Chip>{FRAME_LABEL[ui.frame]}</Chip>- </div>- </CanvasStage>- );-};--type Grade = {- name: string;- filter: string;- tint: string;- sliders: [number, number, number];-};--const NONE_GRADE: Grade = {- name: "None",- filter: "none",- tint: "transparent",- sliders: [0.5, 0.5, 0.5],-};--const GRADES: Grade[] = [- {- name: "Cinematic",- filter: "contrast(1.15) saturate(0.82) sepia(0.12)",- tint: "rgba(24,52,92,0.18)",- sliders: [0.45, 0.68, 0.42],- },- {- name: "Noir",- filter: "grayscale(1) contrast(1.25) brightness(0.96)",- tint: "rgba(0,0,0,0.08)",- sliders: [0.48, 0.78, 0.02],- },- {- name: "Vintage",- filter: "sepia(0.45) contrast(0.95) brightness(1.04) saturate(0.9)",- tint: "rgba(255,196,120,0.16)",- sliders: [0.56, 0.42, 0.44],- },- {- name: "Frost",- filter: "saturate(0.75) brightness(1.06) hue-rotate(-8deg)",- tint: "rgba(168,208,255,0.24)",- sliders: [0.6, 0.46, 0.36],- },- {- name: "Golden",- filter: "sepia(0.3) saturate(1.2) brightness(1.03)",- tint: "rgba(255,186,74,0.2)",- sliders: [0.55, 0.52, 0.66],- },- {- name: "Midnight",- filter: "brightness(0.82) contrast(1.15) saturate(0.9) hue-rotate(12deg)",- tint: "rgba(22,30,86,0.3)",- sliders: [0.3, 0.66, 0.45],- },- {- name: "Vivid",- filter: "saturate(1.55) contrast(1.08)",- tint: "transparent",- sliders: [0.52, 0.6, 0.88],- },- {- name: "Dreamy",- filter: "brightness(1.08) contrast(0.88) saturate(1.15)",- tint: "rgba(255,190,230,0.18)",- sliders: [0.66, 0.36, 0.62],- },-];--const GRADES_DURATION = 9600;-const SWATCH = { w: 62, gap: 6, x: 16, y: CANVAS.h - 16 - 26 };-const GRADE_STOPS: { name: string; at: number }[] = [- { name: "Cinematic", at: 1000 },- { name: "Noir", at: 2400 },- { name: "Golden", at: 3800 },- { name: "Midnight", at: 5200 },- { name: "Vivid", at: 6600 },- { name: "Dreamy", at: 8000 },-];-const SLIDER_LABELS = ["Exposure", "Contrast", "Saturation"];--const swatchCenter = (name: string) => {- const index = GRADES.findIndex((grade) => grade.name === name);- return {- x: SWATCH.x + index * (SWATCH.w + SWATCH.gap) + SWATCH.w / 2,- y: SWATCH.y + 13,- };-};--const GRADE_PATH: Way[] = [- { t: 0, x: 320, y: 190 },- ...GRADE_STOPS.flatMap((stop) => {- const point = swatchCenter(stop.name);- return [- { t: stop.at - 160, ...point },- { t: stop.at, ...point, click: true },- ];- }),- { t: GRADES_DURATION - 600, x: 420, y: 210 },- { t: GRADES_DURATION, x: 420, y: 210 },-];--const gradeAt = (t: number) => {- let current = NONE_GRADE.name;- for (const stop of GRADE_STOPS) if (t >= stop.at) current = stop.name;- return current;-};--export const GradesVisual = ({ playing }: { playing: boolean }) => {- const rootRef = useRef<HTMLDivElement | null>(null);- const [ui, setUi] = useSceneState({ grade: NONE_GRADE.name });- const cursor = useCursor(rootRef);-- useLoop({- duration: GRADES_DURATION,- playing,- pose: 4600,- tick: (t, seek) => {- setUi({ grade: gradeAt(t) });- cursor.tick(GRADE_PATH, t, seek);- },- });-- const grade = GRADES.find((item) => item.name === ui.grade) ?? NONE_GRADE;-- return (- <div ref={rootRef} className="relative">- <CanvasStage wallpaper="/backgrounds/liverpool.webp">- <div- className="absolute inset-0 transition-[filter] duration-500"- style={{ filter: grade.filter }}- >- <RecordedWindow left={56} top={RECORDED.top - 14} />- <CameraBubble playing={playing} top={CANVAS.h - 24 - 96 - 40} />- </div>- <div- className="pointer-events-none absolute inset-0 transition-[background-color] duration-500"- style={{ background: grade.tint, mixBlendMode: "multiply" }}- />- <div- className="pointer-events-none absolute inset-0 transition-opacity duration-500"- style={{- background:- "radial-gradient(85% 75% at 50% 50%, rgba(9,12,20,0) 55%, rgba(9,12,20,0.55) 100%)",- opacity: ui.grade === "None" ? 0 : 0.6,- }}- />-- <div- className="absolute z-20 flex w-[164px] flex-col gap-2.5 rounded-[12px] p-3"- style={{- left: CANVAS.w - 164 - 16,- top: 16,- background: "#fcfcfc",- border: "1px solid rgba(0,0,0,0.08)",- boxShadow: "0 12px 30px -16px rgba(16,24,40,0.5)",- }}- >- {SLIDER_LABELS.map((label, i) => (- <div key={label} className="flex flex-col gap-1.5">- <span className="text-[10.5px] font-medium text-[#202020]">- {label}- </span>- <span className="relative flex h-3 items-center">- <span- className="h-[3px] w-full overflow-hidden rounded-full"- style={{ background: "#e8e8e8" }}- >- <span- className="block h-full rounded-full transition-[width] duration-500"- style={{- width: `${(grade.sliders[i] ?? 0.5) * 100}%`,- background: "#0090ff",- }}- />- </span>- <span- className="absolute size-3 rounded-full border bg-white shadow-sm transition-[left] duration-500"- style={{- left: `calc(${(grade.sliders[i] ?? 0.5) * 100}% - 6px)`,- borderColor: "#d9d9d9",- }}- />- </span>- </div>- ))}- </div>-- <div- className="absolute z-20 flex"- style={{ left: SWATCH.x, top: SWATCH.y, gap: SWATCH.gap }}- >- {GRADES.map((item) => (- <span- key={item.name}- className={classNames(- "flex h-[26px] items-center justify-center rounded-lg text-[11px] font-medium transition-colors duration-200",- ui.grade === item.name- ? "bg-[#111111] text-white"- : "bg-[rgba(252,252,252,0.92)] text-[#202020]",- )}- style={{- width: SWATCH.w,- boxShadow: "0 8px 20px -12px rgba(16,24,40,0.6)",- }}- >- {item.name}- </span>- ))}- </div>- {cursor.Cursor}- </CanvasStage>- </div>- );-};--const CLIPS_DURATION = 10000;-const PANEL = { x: 16, y: 206, w: 568, h: 153 };-const GUTTER = 68;-const LANE_X = PANEL.x + 16 + GUTTER + 8;-const LANE_W = PANEL.w - 32 - GUTTER - 8;-const TRACK_Y = PANEL.y + 16 + 22 + 8;-const TRACK_H = 40;-const CLIP_A = { start: 232, trimmed: 196 };-const CLIP_B = { start: 190, fast: 95 };-const TRIM = { start: 2200, end: 3400 };-const SPEED_AT = 3900;-const FADE_AT = 5200;-const AUDIO_AT = 6400;--const WAVES = Array.from({ length: 48 }, (_, i) => {- const a = Math.sin(i * 0.7) * 0.5 + 0.5;- const b = Math.sin(i * 1.9 + 1) * 0.5 + 0.5;- return { key: `w${i}`, h: 0.25 + 0.7 * (0.5 * a + 0.5 * b) };-});--const clipsUiAt = (t: number) => ({- speed: t >= SPEED_AT,- fade: t >= FADE_AT,- audio: t >= AUDIO_AT,-});--const clipWidthsAt = (t: number) => {- const trim = easeInOut(span(t, TRIM.start, TRIM.end));- const a = lerp(CLIP_A.start, CLIP_A.trimmed, trim);- const b = t >= SPEED_AT ? CLIP_B.fast : CLIP_B.start;- return { a, b };-};--const CLIPS_PATH: Way[] = [- { t: 0, x: 420, y: 120 },- { t: 1900, x: LANE_X + CLIP_A.start + 2, y: TRACK_Y + TRACK_H / 2 },- { t: TRIM.start, x: LANE_X + CLIP_A.start + 2, y: TRACK_Y + TRACK_H / 2 },- { t: TRIM.end, x: LANE_X + CLIP_A.trimmed + 2, y: TRACK_Y + TRACK_H / 2 },- {- t: SPEED_AT - 150,- x: LANE_X + CLIP_A.trimmed + 6 + CLIP_B.start / 2,- y: TRACK_Y + TRACK_H / 2,- },- {- t: SPEED_AT,- x: LANE_X + CLIP_A.trimmed + 6 + CLIP_B.start / 2,- y: TRACK_Y + TRACK_H / 2,- click: true,- },- { t: FADE_AT - 150, x: LANE_X + CLIP_A.trimmed + 3, y: TRACK_Y - 6 },- { t: FADE_AT, x: LANE_X + CLIP_A.trimmed + 3, y: TRACK_Y - 6, click: true },- { t: AUDIO_AT + 400, x: 470, y: 150 },- { t: CLIPS_DURATION, x: 470, y: 150 },-];--export const ClipsVisual = ({ playing }: { playing: boolean }) => {- const rootRef = useRef<HTMLDivElement | null>(null);- const clipARef = useRef<HTMLDivElement | null>(null);- const clipBRef = useRef<HTMLDivElement | null>(null);- const seamRef = useRef<HTMLDivElement | null>(null);- const playheadRef = useRef<HTMLDivElement | null>(null);- const [ui, setUi] = useSceneState(clipsUiAt(0));- const cursor = useCursor(rootRef);-- useLoop({- duration: CLIPS_DURATION,- playing,- pose: 7200,- tick: (t, seek) => {- setUi(clipsUiAt(t));- const { a, b } = clipWidthsAt(t);- if (clipARef.current) clipARef.current.style.width = `${a}px`;- if (clipBRef.current) {- clipBRef.current.style.left = `${a + 6}px`;- clipBRef.current.style.width = `${b}px`;- }- if (seamRef.current) seamRef.current.style.left = `${a - 6}px`;- const frac = (t % 3200) / 3200;- const fast = t >= SPEED_AT;- const split = fast ? 0.66 : a / (a + b);- const head =- frac < split- ? lerp(0, a, frac / split)- : lerp(a + 6, a + 6 + b, (frac - split) / (1 - split));- if (playheadRef.current) {- playheadRef.current.style.transform = `translateX(${head}px)`;- }- cursor.tick(CLIPS_PATH, t, seek);- },- });-- return (- <div ref={rootRef} className="relative">- <CanvasStage wallpaper="/backgrounds/sf.webp">- <RecordedWindow left={170} top={22} width={280} height={162} />- <CameraBubble playing={playing} size={56} left={130} top={130} />-- <div- className="absolute z-10 rounded-[12px] p-4"- style={{- left: PANEL.x,- top: PANEL.y,- width: PANEL.w,- height: PANEL.h,- background: "#fcfcfc",- border: "1px solid rgba(0,0,0,0.08)",- boxShadow: "0 18px 40px -18px rgba(16,24,40,0.5)",- }}- >- <div className="flex gap-2">- <div style={{ width: GUTTER }} />- <div- className="relative h-[22px] flex-1 text-[9.5px]"- style={{ color: "#8d8d8d" }}- >- {["0:00", "0:05", "0:10", "0:15", "0:20"].map((label, i) => (- <span- key={label}- className="absolute top-0 flex -translate-x-1/2 flex-col items-center gap-0.5"- style={{ left: `${(i / 4.4) * 100}%` }}- >- {label}- <span className="size-[3px] rounded-full bg-current" />- </span>- ))}- </div>- </div>-- <div className="mt-2 flex gap-2">- <div- className="flex shrink-0 items-center justify-center rounded-lg text-[10px] font-medium text-white"- style={{- width: GUTTER,- height: TRACK_H,- background: "#3f8ae0",- border: "1px solid #2a5c96",- }}- >- Video- </div>- <div className="relative flex-1" style={{ height: TRACK_H }}>- <div- ref={clipARef}- className="absolute inset-y-0 left-0 overflow-hidden rounded-lg"- style={{- width: CLIP_A.start,- background: "#3f8ae0",- border: "1px solid #2a5c96",- }}- >- <span className="absolute left-2 top-1.5 text-[9.5px] font-medium text-white/80">- Clip 1- </span>- <span className="absolute inset-x-1 bottom-1 flex h-3 items-end gap-px">- {WAVES.slice(0, 30).map((wave) => (- <span- key={wave.key}- className="flex-1 rounded-[1px]"- style={{- height: `${wave.h * 100}%`,- background: "rgba(255,255,255,0.45)",- }}- />- ))}- </span>- </div>- <div- ref={clipBRef}- className="absolute inset-y-0 overflow-hidden rounded-lg transition-[width] duration-500"- style={{- left: CLIP_A.start + 6,- width: CLIP_B.start,- background: "#3f8ae0",- border: "1px solid #2a5c96",- }}- >- <span className="absolute left-2 top-1.5 text-[9.5px] font-medium text-white/80">- Clip 2- </span>- <span- className={classNames(- "absolute right-1.5 top-1 rounded-md px-1.5 py-0.5 text-[9.5px] font-semibold transition-opacity duration-300",- ui.speed ? "opacity-100" : "opacity-0",- )}- style={{ background: "#ffffff", color: "#2563eb" }}- >- 2×- </span>- <span className="absolute inset-x-1 bottom-1 flex h-3 items-end gap-px">- {WAVES.slice(18, 40).map((wave) => (- <span- key={wave.key}- className="flex-1 rounded-[1px]"- style={{- height: `${wave.h * 100}%`,- background: "rgba(255,255,255,0.45)",- }}- />- ))}- </span>- </div>- <div- ref={seamRef}- className={classNames(- "pointer-events-none absolute -top-1 -bottom-1 w-[18px] rounded-md transition-opacity duration-300",- ui.fade ? "opacity-100" : "opacity-0",- )}- style={{- left: CLIP_A.start - 6,- background:- "linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0) 100%)",- boxShadow: "0 0 18px 2px rgba(255,255,255,0.55)",- }}- >- <span- className="absolute -top-5 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md px-1.5 py-0.5 text-[9px] font-medium text-white"- style={{ background: "#202020" }}- >- Crossfade- </span>- </div>- <div- ref={playheadRef}- className="pointer-events-none absolute -top-2 bottom-0 left-0 will-change-transform"- >- <span- className="absolute -left-[4px] top-0 size-[9px] rounded-full"- style={{ background: "rgb(226,64,64)" }}- />- <span- className="absolute left-0 top-1 h-full w-px"- style={{- background:- "linear-gradient(rgb(226,64,64), rgba(226,64,64,0.2))",- }}- />- </div>- </div>- </div>-- <div- className={classNames(- "mt-2 flex gap-2 transition-[opacity,transform] duration-500",- ui.audio- ? "translate-y-0 opacity-100"- : "translate-y-2 opacity-0",- )}- >- <div- className="flex shrink-0 items-center justify-center rounded-lg text-[10px] font-medium text-white"- style={{- width: GUTTER,- height: 30,- background: "#2f7a5b",- border: "1px solid #1f5a42",- }}- >- Audio- </div>- <div- className="relative overflow-hidden rounded-lg"- style={{- width: LANE_W * 0.9,- height: 30,- background: "#dff3e9",- border: "1px solid #bfe3d1",- }}- >- <span- className="absolute left-2 top-1 text-[9.5px] font-medium"- style={{ color: "#0f7a58" }}- >- Lofi 03- </span>- <span className="absolute inset-x-1 bottom-1 flex h-2.5 items-end gap-px">- {WAVES.map((wave) => (- <span- key={wave.key}- className="flex-1 rounded-[1px]"- style={{- height: `${wave.h * 100}%`,- background: "rgba(15,122,88,0.45)",- }}- />- ))}- </span>- </div>- </div>- </div>- {cursor.Cursor}- </CanvasStage>- </div>- );-};diff --git a/apps/web/components/pages/HomeTwo/studio/catalog.ts b/apps/web/components/pages/HomeTwo/studio/catalog.tsindex ef5d8234e..2e96ab319 100644--- a/apps/web/components/pages/HomeTwo/studio/catalog.ts+++ b/apps/web/components/pages/HomeTwo/studio/catalog.ts@@ -3,48 +3,39 @@import dynamic from "next/dynamic";import type { StudioCard } from "./shared";+const visual = (load: () => Promise<{ Visual: StudioCard["Visual"] }>) =>+ dynamic(() => load().then((module) => module.Visual));+export const CARDS_A: StudioCard[] = [{key: "mask",title: "Blur what is private",body: "Drop a mask over a password, an email, or a face and choose blur or pixelate. Or flip it to a highlight that dims everything else.",- span: 2,- Visual: dynamic(() =>- import("./cardsA").then((module) => module.BlurVisual),- ),+ Visual: visual(() => import("./cards/mask")),},{key: "scenes",title: "Scenes for screen and camera",body: "Switch any stretch of the timeline to camera only, hide camera, split screen, or floating cards, each with its own transition.",- span: 2,- Visual: dynamic(() =>- import("./cardsA").then((module) => module.ScenesVisual),- ),+ Visual: visual(() => import("./cards/scenes")),},{key: "text",title: "Text that animates",body: "Titles, lower thirds, big stats, and typewriter callouts as stackable tracks, with fade, slide, pop, or typewriter in and out.",- Visual: dynamic(() =>- import("./cardsA").then((module) => module.TextVisual),- ),+ Visual: visual(() => import("./cards/text")),},{key: "zoom",title: "Automatic zoom",body: "Generate zooms from your recorded clicks, or draw your own from 1x to 4.5x with a fixed focal point.",- Visual: dynamic(() =>- import("./cardsA").then((module) => module.ZoomVisual),- ),+ Visual: visual(() => import("./cards/zoom")),},{key: "captions",title: "Captions, generated locally",body: "Transcribe on your machine in 19 languages, fix the words, style them, and burn them in with the active word highlighted.",- Visual: dynamic(() =>- import("./cardsA").then((module) => module.CaptionsVisual),- ),+ Visual: visual(() => import("./cards/captions")),},];@@ -53,32 +44,24 @@ export const CARDS_B: StudioCard[] = [key: "three-d",title: "3D camera moves",body: "Tilt the frame into perspective and glide, sweep, or pull back across it with focus blur.",- Visual: dynamic(() =>- import("./cardsB").then((module) => module.ThreeDVisual),- ),+ Visual: visual(() => import("./cards/threeD")),},{key: "canvas",title: "Any canvas, one recording",body: "Wallpapers, gradients, or your own image, then padding, corners, shadows, and a macOS, Windows, browser, or MacBook frame.",- Visual: dynamic(() =>- import("./cardsB").then((module) => module.CanvasVisual),- ),+ Visual: visual(() => import("./cards/canvas")),},{key: "grades",title: "Color grades",body: "Cinematic, Noir, Vintage, Frost, Golden, Midnight, Vivid, or Dreamy, then dial exposure, contrast, and vignette.",- Visual: dynamic(() =>- import("./cardsB").then((module) => module.GradesVisual),- ),+ Visual: visual(() => import("./cards/grades")),},{key: "clips",title: "Clips, speed, and music",body: "Trim, split, reorder, speed up to 8x, crossfade between clips, and lay a track from the built in library underneath.",- Visual: dynamic(() =>- import("./cardsB").then((module) => module.ClipsVisual),- ),+ Visual: visual(() => import("./cards/clips")),},];diff --git a/apps/web/components/pages/HomeTwo/studio/shared.tsx b/apps/web/components/pages/HomeTwo/studio/shared.tsxindex ed0f0fa8c..4c462e60c 100644--- a/apps/web/components/pages/HomeTwo/studio/shared.tsx+++ b/apps/web/components/pages/HomeTwo/studio/shared.tsx@@ -1,29 +1,63 @@"use client";import { classNames } from "@cap/utils/helpers";-import Image from "next/image";import {type ComponentType,type CSSProperties,type ReactNode,+ type RefObject,useEffect,useRef,} from "react";import { ContentWindow } from "../demo/MacDesktop";import { useVideoAttrs, VIDEO_POSTERS } from "../demo/media";-import { useVideo } from "../scenes/engine";+import { SCENE_CSS, useVideo } from "../scenes/engine";import { useReducedMotion } from "../visibility";export type StudioCard = {key: string;title: string;body: string;- span?: 1 | 2;Visual: ComponentType<{ playing: boolean }>;};export const CANVAS = { w: 600, h: 375 } as const;+/** The desktop editor's light theme (apps/desktop/src/styles/theme.css, ed-* tokens). */+export const ED = {+ window: "#f1f1f3",+ card: "#ffffff",+ card2: "#f6f6f7",+ stage: "#e9e9ec",+ line: "rgba(0,0,0,0.075)",+ lineStrong: "rgba(0,0,0,0.12)",+ text1: "#1c1c1e",+ text2: "#6e6e75",+ text3: "#a0a0a8",+ ctl: "rgba(0,0,0,0.045)",+ ctlHover: "rgba(0,0,0,0.075)",+ ctlActive: "rgba(0,0,0,0.11)",+ accent: "#007aff",+ playhead: "#ff3b30",+ cardShadow: "0 1px 2px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.075)",+ popShadow: "0 12px 32px -12px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.075)",+} as const;++/** Timeline track hues (the editor's single source of truth). */+export const HUE = {+ clip: "#3b82f6",+ zoom: "#64748b",+ caption: "#0ea5e9",+ text: "#14b8a6",+ mask: "#ef4444",+ scene: "#8b5cf6",+ audio: "#22c55e",+ threeD: "#6366f1",+} as const;++export const mix = (hue: string, pct: number, base = "#ffffff") =>+ `color-mix(in srgb, ${hue} ${pct}%, ${base})`;+export const useLoop = ({duration,playing,@@ -64,32 +98,42 @@ export const useLoop = ({}, [playing, reduced, duration, pose]);};-export const CanvasStage = ({- wallpaper = "/backgrounds/monaco.webp",+export type Tone = "light" | "chrome" | "dark" | "gradient";++const GROUND_BG: Record<Tone, string> = {+ light: "#F4F6F9",+ chrome: ED.window,+ dark: "#141518",+ gradient: "linear-gradient(135deg, #C3DCF8 0%, #DACBF9 55%, #F6D9EC 100%)",+};++/**+ * The card canvas: a flat, quiet ground with nothing on it. Every card+ * decides what earns the eye; nothing shares a wallpaper or a webcam by+ * default.+ */+export const Ground = ({+ tone = "light",className,style,children,}: {- wallpaper?: string;+ tone?: Tone;className?: string;style?: CSSProperties;children: ReactNode;}) => (<div- className={classNames(- "relative overflow-hidden rounded-[12px] bg-black",- className,- )}- style={{ width: CANVAS.w, height: CANVAS.h, ...style }}+ className={classNames("relative overflow-hidden", className)}+ style={{+ width: CANVAS.w,+ height: CANVAS.h,+ background: GROUND_BG[tone],+ color: tone === "dark" ? "#ffffff" : ED.text1,+ ...style,+ }}>- <Image- src={wallpaper}- alt=""- fill- sizes="600px"- draggable={false}- className="object-cover"- />+ <style>{SCENE_CSS}</style>{children}</div>);@@ -106,6 +150,7 @@ export const RecordedWindow = ({top = RECORDED.top,width = RECORDED.width,height = RECORDED.height,+ scale = 1,className,style,}: {@@ -113,6 +158,7 @@ export const RecordedWindow = ({top?: number;width?: number;height?: number;+ scale?: number;className?: string;style?: CSSProperties;}) => {@@ -120,13 +166,22 @@ export const RecordedWindow = ({return (<divclassName={classNames("absolute", className)}- style={{ left, top, width, height, ...style }}+ style={{+ left,+ top,+ width,+ height,+ transform: scale === 1 ? undefined : `scale(${scale})`,+ transformOrigin: "top left",+ ...style,+ }}><ContentWindow width={width} height={height} scrollRef={scrollRef} /></div>);};+/** Only for the card whose subject is the camera itself. */export const CameraBubble = ({playing,size = 96,@@ -188,13 +243,523 @@ export const Chip = ({className,)}style={{- background: "#fcfcfc",- color: "#202020",- border: "1px solid rgba(0,0,0,0.08)",- boxShadow: "0 8px 20px -10px rgba(16,24,40,0.45)",+ background: ED.card,+ color: ED.text1,+ boxShadow: ED.popShadow,+ ...style,+ }}+ >+ {children}+ </span>+);++/* ---- Editor sidebar primitives (1:1 with apps/desktop/src/routes/editor/ui.tsx) ---- */++/** A floating editor card: white, rounded-xl, the editor's pop shadow. */+export const Panel = ({+ className,+ style,+ children,+}: {+ className?: string;+ style?: CSSProperties;+ children: ReactNode;+}) => (+ <div+ className={classNames(+ "absolute flex flex-col gap-3.5 rounded-xl p-4",+ className,+ )}+ style={{ background: ED.card, boxShadow: ED.popShadow, ...style }}+ >+ {children}+ </div>+);++/** Section title: 12px/500 text-2, min height 22. */+export const SectionTitle = ({+ children,+ right,+}: {+ children: ReactNode;+ right?: ReactNode;+}) => (+ <div className="flex min-h-[22px] items-center justify-between">+ <span className="text-[12px] font-medium" style={{ color: ED.text2 }}>+ {children}+ </span>+ {right}+ </div>+);++/** Stacked field: 13px/400 text-1 label, gap 8. */+export const Field = ({+ label,+ value,+ badge,+ disabled,+ children,+}: {+ label: ReactNode;+ value?: ReactNode;+ badge?: ReactNode;+ disabled?: boolean;+ children?: ReactNode;+}) => (+ <div className="flex flex-col gap-2">+ <div className="flex items-center gap-1.5">+ <span+ className="text-[13px] font-normal"+ style={{ color: disabled ? ED.text3 : ED.text1 }}+ >+ {label}+ </span>+ {badge ? (+ <span+ className="rounded-full px-1.5 py-0.5 text-[10px] font-medium"+ style={{ background: ED.ctl, color: ED.text2 }}+ >+ {badge}+ </span>+ ) : null}+ {value !== undefined ? (+ <span+ className="ml-auto min-w-9 text-right text-[11px] tabular-nums"+ style={{ color: ED.text3 }}+ >+ {value}+ </span>+ ) : null}+ </div>+ {children}+ </div>+);++/** Inline field: 34px row, label left, control right. */+export const InlineField = ({+ label,+ value,+ children,+}: {+ label: ReactNode;+ value?: ReactNode;+ children?: ReactNode;+}) => (+ <div className="flex h-[34px] items-center gap-3">+ <span+ className="min-w-24 shrink-0 text-[13px] font-normal"+ style={{ color: ED.text1 }}+ >+ {label}+ </span>+ <div className="flex flex-1 items-center justify-end gap-2">+ {children}+ {value !== undefined ? (+ <span+ className="min-w-9 text-right text-[11px] tabular-nums"+ style={{ color: ED.text3 }}+ >+ {value}+ </span>+ ) : null}+ </div>+ </div>+);++export const Slider = ({+ fill,+ className,+}: {+ fill: number;+ className?: string;+}) => (+ <div className={classNames("relative flex h-8 items-center px-1", className)}>+ <div+ className="h-[3px] w-full overflow-hidden rounded-full"+ style={{ background: ED.ctlActive }}+ >+ <div+ className="h-full rounded-full transition-[width] duration-300 ease-out"+ style={{ width: `${fill * 100}%`, background: ED.accent }}+ />+ </div>+ <span+ className="absolute size-3.5 rounded-full transition-[left] duration-300 ease-out"+ style={{+ left: `calc(4px + (100% - 8px) * ${fill} - 7px)`,+ background: "#ffffff",+ boxShadow: "0 1px 3px rgba(0,0,0,0.25), 0 0 0 0.5px rgba(0,0,0,0.1)",+ }}+ />+ </div>+);++export const Segmented = ({+ options,+ value,+ itemWidth,+ disabled,+ className,+ style,+}: {+ options: readonly string[];+ value: string | null;+ itemWidth?: number;+ disabled?: boolean;+ className?: string;+ style?: CSSProperties;+}) => (+ <div+ className={classNames(+ "flex gap-0.5 rounded-lg p-0.5 transition-opacity duration-200",+ disabled && "opacity-50",+ className,+ )}+ style={{ background: ED.ctl, ...style }}+ >+ {options.map((option) => {+ const on = value === option;+ return (+ <span+ key={option}+ className="flex h-[26px] flex-1 items-center justify-center whitespace-nowrap rounded-md px-3 text-[11.5px] font-medium transition-[background-color,color,box-shadow] duration-200"+ style={{+ width: itemWidth,+ background: on ? ED.card : "transparent",+ color: on ? ED.text1 : ED.text2,+ boxShadow: on+ ? "0 1px 2px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.06)"+ : undefined,+ }}+ >+ {option}+ </span>+ );+ })}+ </div>+);++/** The editor's `Toggle` (md): 44x24, accent when on. */+export const Toggle = ({ on }: { on: boolean }) => (+ <span+ className="relative inline-flex h-6 w-11 shrink-0 rounded-full p-0.5 transition-colors duration-200"+ style={{ background: on ? ED.accent : ED.ctlActive }}+ >+ <span+ className="absolute top-0.5 size-5 rounded-full bg-white transition-[left] duration-200"+ style={{+ left: on ? 22 : 2,+ boxShadow: "0 1px 3px rgba(0,0,0,0.22)",+ }}+ />+ </span>+);++/** Small editor button: 22px, 12px/500, rounded 7. */+export const EditorButton = ({+ children,+ primary,+ className,+ style,+}: {+ children: ReactNode;+ primary?: boolean;+ className?: string;+ style?: CSSProperties;+}) => (+ <span+ className={classNames(+ "inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-[7px] px-2.5 text-[13px] font-medium",+ className,+ )}+ style={{+ background: primary ? ED.accent : ED.ctl,+ color: primary ? "#ffffff" : ED.text1,...style,}}>{children}</span>);++/** Selectable tile like the Camera Layout / preset grids: 30px, ctl bg, hover-ish when selected. */+export const Tile = ({+ selected,+ children,+ className,+ style,+}: {+ selected?: boolean;+ children: ReactNode;+ className?: string;+ style?: CSSProperties;+}) => (+ <span+ className={classNames(+ "flex h-[30px] items-center justify-center gap-1.5 whitespace-nowrap rounded-lg px-2 text-[11.5px] font-medium transition-colors duration-200",+ className,+ )}+ style={{+ background: selected ? ED.ctlHover : ED.ctl,+ color: selected ? ED.text1 : ED.text2,+ ...style,+ }}+ >+ {children}+ </span>+);++/* ---- Editor timeline primitives (1:1 with Timeline/styles.css) ---- */++export const TRACK_H = 44;+export const TRACK_GAP = 6;+export const TRACK_GUTTER = 96;+export const RULER_H = 26;++/** The 96px row gutter: a 22px hue tile + an 11px label. */+export const TrackLabel = ({+ hue,+ icon,+ children,+ style,+}: {+ hue: string;+ icon?: ReactNode;+ children: ReactNode;+ style?: CSSProperties;+}) => (+ <div+ className="flex shrink-0 items-center gap-2"+ style={{ width: TRACK_GUTTER, height: TRACK_H, ...style }}+ >+ <span+ className="grid size-[22px] shrink-0 place-items-center rounded-md"+ style={{+ background: mix(hue, 16, "transparent"),+ color: mix(hue, 62, "#000000"),+ }}+ >+ {icon ? <span className="size-3.5">{icon}</span> : null}+ </span>+ <span+ className="truncate text-[11px] font-medium"+ style={{ color: ED.text2 }}+ >+ {children}+ </span>+ </div>+);++export const Lane = ({+ empty,+ className,+ style,+ children,+}: {+ empty?: ReactNode;+ className?: string;+ style?: CSSProperties;+ children?: ReactNode;+}) => (+ <div+ className={classNames("relative flex-1", className)}+ style={{ height: TRACK_H, ...style }}+ >+ {empty ? (+ <div+ className="absolute inset-0 flex items-center justify-center gap-1.5 rounded-lg border border-dashed text-[12px]"+ style={{ borderColor: ED.lineStrong, color: ED.text3 }}+ >+ {empty}+ </div>+ ) : null}+ {children}+ </div>+);++/** A timeline segment: 13% tint, 1px ring, 3px hue bar on the left, dark tinted labels. */+export const Segment = ({+ hue,+ label,+ sublabel,+ trailing,+ selected,+ segmentRef,+ className,+ style,+ children,+}: {+ hue: string;+ label?: ReactNode;+ sublabel?: ReactNode;+ trailing?: ReactNode;+ selected?: boolean;+ segmentRef?: RefObject<HTMLDivElement | null>;+ className?: string;+ style?: CSSProperties;+ children?: ReactNode;+}) => (+ <div+ ref={segmentRef}+ className={classNames(+ "absolute inset-y-0 overflow-hidden rounded-lg",+ className,+ )}+ style={{+ background: mix(hue, selected ? 23 : 13),+ boxShadow: selected+ ? `inset 0 0 0 1.5px ${ED.accent}`+ : `inset 0 0 0 1px ${mix(hue, 34, "transparent")}`,+ ...style,+ }}+ >+ <span+ className="absolute inset-y-0 left-0 w-[3px]"+ style={{ background: hue }}+ />+ {label !== undefined ? (+ <span className="absolute left-[13px] top-1/2 flex -translate-y-1/2 items-center gap-2 whitespace-nowrap">+ <span+ className="text-[12px] font-medium"+ style={{ color: mix(hue, 58, "#000000") }}+ >+ {label}+ </span>+ {sublabel !== undefined ? (+ <span+ className="text-[11px] tabular-nums"+ style={{ color: mix(hue, 45, ED.text3) }}+ >+ {sublabel}+ </span>+ ) : null}+ {trailing}+ </span>+ ) : null}+ {children}+ </div>+);++/** The ruler header: 26px, 11px tabular labels in text-3. */+export const Ruler = ({+ labels,+ span: total,+ className,+ style,+}: {+ labels: string[];+ span: number;+ className?: string;+ style?: CSSProperties;+}) => (+ <div+ className={classNames(+ "relative flex-1 text-[11px] tabular-nums",+ className,+ )}+ style={{ height: RULER_H, color: ED.text3, ...style }}+ >+ {labels.map((label, i) => (+ <span+ key={label}+ className={classNames(+ "absolute top-1 flex flex-col gap-1",+ i === 0 ? "items-start" : "-translate-x-1/2 items-center",+ )}+ style={{ left: `${(i / total) * 100}%` }}+ >+ <span>{label}</span>+ <span className="h-1 w-px" style={{ background: ED.lineStrong }} />+ </span>+ ))}+ </div>+);++/** The playhead: a 1px line with a 12px dot ringed in card white. */+export const Playhead = ({+ playheadRef,+ top = 0,+ bottom = 0,+ left = 0,+}: {+ playheadRef: RefObject<HTMLDivElement | null>;+ top?: number;+ bottom?: number;+ left?: number;+}) => (+ <div+ ref={playheadRef}+ className="pointer-events-none absolute z-20 will-change-transform"+ style={{ top, bottom, left }}+ >+ <span+ className="absolute -left-[6px] top-0 size-3 rounded-full"+ style={{ background: ED.playhead, boxShadow: `0 0 0 2px ${ED.card}` }}+ />+ <span+ className="absolute left-0 top-1.5 h-full w-px"+ style={{ background: ED.playhead }}+ />+ </div>+);++export const WAVES = Array.from({ length: 64 }, (_, i) => {+ const a = Math.sin(i * 0.7) * 0.5 + 0.5;+ const b = Math.sin(i * 1.9 + 1) * 0.5 + 0.5;+ return { key: `w${i}`, h: 0.25 + 0.7 * (0.5 * a + 0.5 * b) };+});++/** The 18px waveform strip drawn along the bottom of a clip, in the track hue. */+export const Waveform = ({+ from = 0,+ to = WAVES.length,+ color,+ className,+}: {+ from?: number;+ to?: number;+ color?: string;+ className?: string;+}) => (+ <span+ className={classNames(+ "absolute inset-x-2 bottom-0 flex h-[18px] items-end gap-px",+ className,+ )}+ >+ {WAVES.slice(from, to).map((wave) => (+ <span+ key={wave.key}+ className="flex-1 rounded-[1px]"+ style={{+ height: `${wave.h * 100}%`,+ background: color ?? mix(HUE.clip, 45, "transparent"),+ }}+ />+ ))}+ </span>+);++/** The speed chip inside a clip segment. */+export const SpeedChip = ({+ children,+ active,+ className,+}: {+ children: ReactNode;+ active?: boolean;+ className?: string;+}) => (+ <span+ className={classNames(+ "inline-flex h-4 items-center rounded-full px-1.5 text-[10px] font-medium leading-none transition-colors duration-300",+ className,+ )}+ style={{+ background: active ? ED.accent : ED.ctlActive,+ color: active ? "#ffffff" : ED.text1,+ }}+ >+ {children}+ </span>+);