Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: rebuild registry
kapishdimaa7dad8e645d4
diff --git a/registry-artifacts/ascii-dissolve.json b/registry-artifacts/ascii-dissolve.jsonnew file mode 100644index 00000000..ef6f2518--- /dev/null+++ b/registry-artifacts/ascii-dissolve.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "ascii-dissolve",+ "title": "ASCII Dissolve",+ "description": "Dissolve one scene into the next through a drifting field of ASCII glyphs.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/ascii-dissolve/index.tsx",+ "content": "\"use client\";\n\nimport React from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n continueRender,\n delayRender,\n interpolate,\n random,\n useVideoConfig,\n} from \"remotion\";\nimport type {\n TransitionPresentation,\n TransitionPresentationComponentProps,\n} from \"@remotion/transitions\";\n\nconst clampOpts = {\n extrapolateLeft: \"clamp\" as const,\n extrapolateRight: \"clamp\" as const,\n};\n\n// ---------------------------------------------------------------------------\n// ascii-dissolve — the frame becomes plain text. The outgoing scene fades as\n// a fullscreen field of monospace glyphs rises over it: a deterministic\n// noise field drives each cell through a density ramp (\" .:-=+*#%@\"), so the\n// cover reads as living ASCII. It holds fully opaque long enough to be READ\n// as text, then the cells drop back down the ramp to space while the\n// incoming scene resolves beneath.\n//\n// Text mode (enterText): the outgoing scene blurs out under the rising\n// field; the incoming headline is never previewed as ascii — the field\n// dissolves cell by cell (per-cell staggered, never a flat plane) while\n// the real text fades in over it. `enterStyle` picks what happens AROUND\n// the arriving text:\n// \"fade\" — plain: staggered dissolve everywhere, text fades in.\n// \"clearing\" — the dissolve order is biased by distance to the text:\n// cells near the headline vanish first, the field opens a\n// granular cavity around it.\n// \"halo\" — a smooth radial attenuation grows around the text: near\n// cells slide down the ramp into thin glyphs, a soft dark\n// well forms behind the headline.\n// \"wave\" — one density impulse rides outward from the text: cells\n// on the wavefront jump up the ramp for a beat, then the\n// front leaves cleared field behind it.\n// \"focus\" — the field defocuses: it blurs and dims while the sharp\n// text resolves — a depth-of-field handoff.\n// \"lime-echo\" — on landing, a sparse ring of accent-colored glyphs\n// flashes once around the headline and settles.\n//\n// Fully deterministic: per-cell jitter comes from remotion's seeded random,\n// the flow from fixed sinusoids over progress, the letterform masks from a\n// one-time offscreen-canvas sample of the loaded fonts.\n// ---------------------------------------------------------------------------\n\nexport type AsciiTextSpec = {\n /** The incoming headline (used for timing and the zone styles). */\n text: string;\n /** Must match the scene's rendered text exactly. */\n fontSize: number;\n /** Concrete family list for canvas sampling (CSS vars won't resolve). */\n fontFamily: string;\n /** Default 400. */\n fontWeight?: number;\n /** Letter-spacing in em, if the scene's text carries one. Default 0. */\n letterSpacingEm?: number;\n /** Glyph color of the ASCII letterform. Default ink. */\n color?: string;\n /** Vertical offset from frame center, px. Default 0. */\n offsetY?: number;\n};\n\nexport type AsciiEnterStyle =\n | \"fade\"\n | \"clearing\"\n | \"halo\"\n | \"wave\"\n | \"focus\"\n | \"lime-echo\";\n\nexport type AsciiDissolveProps = {\n /** Row height of one glyph cell in px. Default 22 (use ~14 in text mode). */\n cellSize?: number;\n /** Glyph color. Default translucent ink. */\n colorFront?: string;\n /** Canvas behind the glyphs during the hold. Default near-black. */\n colorBack?: string;\n /** Optional second color for a sparse scattering of accent cells. */\n accentColor?: string;\n /** Share of cells rendered in the accent color, 0..1. Default 0.05. */\n accentDensity?: number;\n /** Density ramp, lightest → densest. Default \" .:-=+*#%@\". */\n ramp?: string;\n /** Monospace stack for the field. */\n fontFamily?: string;\n /** Text mode: the incoming headline (used for timing and as the zone). */\n enterText?: AsciiTextSpec;\n /** What happens around the arriving text. Default \"fade\". */\n enterStyle?: AsciiEnterStyle;\n /** Progress window over which the outgoing scene fades out. */\n exitFade?: [number, number];\n /** Progress window over which the incoming scene resolves. */\n enterFade?: [number, number];\n};\n\n// Per-cell stagger: global window progress g plus jitter j → this cell's\n// local progress. spread controls how far cells drift apart.\nconst stagger = (g: number, j: number, spread = 0.55) =>\n Math.max(0, Math.min(1, (g - j * spread) / (1 - spread)));\n\n// The field's mono advance, measured at the size the <pre> renders.\nconst measureAdvance = (fontFamily: string, fontSize: number): number => {\n const fallback = fontSize * 0.6;\n if (typeof document === \"undefined\") return fallback;\n const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n if (!ctx) return fallback;\n ctx.font = `400 ${fontSize}px ${fontFamily}`;\n const w = ctx.measureText(\"0\").width;\n return w > 0 ? w : fallback;\n};\n\n// Sample the headline's letterforms: draw the text once on an offscreen\n// canvas at 2× cell resolution and grade each cell by subsample coverage\n// (0..4). Edge cells get mid-ramp glyphs, core cells the densest — the\n// grading anti-aliases the letter contours, so strokes thinner than a cell\n// still read as continuous letters.\nconst buildTextMask = (\n spec: AsciiTextSpec,\n width: number,\n height: number,\n cols: number,\n rows: number,\n advance: number,\n cellH: number,\n): Uint8Array | null => {\n if (typeof document === \"undefined\") return null;\n const canvas = document.createElement(\"canvas\");\n canvas.width = cols * 2;\n canvas.height = rows * 2;\n const ctx = canvas.getContext(\"2d\", { willReadFrequently: true });\n if (!ctx) return null;\n ctx.setTransform(2 / advance, 0, 0, 2 / cellH, 0, 0);\n ctx.font = `${spec.fontWeight ?? 400} ${spec.fontSize}px ${spec.fontFamily}`;\n const spacing = (spec.letterSpacingEm ?? 0) * spec.fontSize;\n if (spacing !== 0) {\n (ctx as CanvasRenderingContext2D & { letterSpacing?: string }).letterSpacing = `${spacing}px`;\n }\n ctx.textAlign = \"center\";\n // Canvas \"middle\" baseline is computed from the em square and lands\n // visibly ABOVE where a flex-centered DOM span puts the same text. Rebuild\n // the DOM's math instead: a flex-centered span (line-height normal) puts\n // its baseline at H/2 + (ascent - descent)/2, with ascent/descent taken\n // from the font's own metrics.\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = \"#fff\";\n const metrics = ctx.measureText(spec.text);\n const ascent = metrics.fontBoundingBoxAscent ?? spec.fontSize * 0.8;\n const descent = metrics.fontBoundingBoxDescent ?? spec.fontSize * 0.2;\n const baselineY = height / 2 + (ascent - descent) / 2 + (spec.offsetY ?? 0);\n ctx.fillText(spec.text, width / 2, baselineY);\n const data = ctx.getImageData(0, 0, cols * 2, rows * 2).data;\n const mask = new Uint8Array(cols * rows);\n for (let y = 0; y < rows; y++) {\n for (let x = 0; x < cols; x++) {\n let hits = 0;\n if (data[((y * 2) * cols * 2 + x * 2) * 4 + 3] > 100) hits++;\n if (data[((y * 2) * cols * 2 + x * 2 + 1) * 4 + 3] > 100) hits++;\n if (data[((y * 2 + 1) * cols * 2 + x * 2) * 4 + 3] > 100) hits++;\n if (data[((y * 2 + 1) * cols * 2 + x * 2 + 1) * 4 + 3] > 100) hits++;\n mask[y * cols + x] = hits;\n }\n }\n return mask;\n};\n\nconst AsciiDissolvePresentation: React.FC<\n TransitionPresentationComponentProps<AsciiDissolveProps>\n> = ({ children, presentationProgress, presentationDirection, passedProps }) => {\n const {\n cellSize = 22,\n colorFront = \"rgba(242,242,242,0.6)\",\n colorBack = \"#0d0d10\",\n accentColor,\n accentDensity = 0.05,\n ramp = \" .:-=+*#%@\",\n fontFamily = \"ui-monospace, SFMono-Regular, Menlo, monospace\",\n enterText,\n enterStyle = \"fade\",\n exitFade,\n enterFade,\n } = passedProps;\n const { width, height } = useVideoConfig();\n const entering = presentationDirection === \"entering\";\n const p = presentationProgress;\n const textMode = enterText !== undefined;\n\n // The outgoing scene blurs out under the rising field.\n const exitWindow = exitFade ?? [0.14, 0.3];\n // The real text fades in while the field dissolves cell by cell.\n const enterWindow = enterFade ?? (textMode ? [0.6, 0.8] : [0.62, 0.8]);\n\n // The masks and the mono advance must be measured with the REAL webfonts.\n // The component can mount while they are still loading (a fallback font\n // would bake wrong metrics into the memoized masks and shift the letterform\n // off the scene's text) — so gate on document.fonts and hold the render.\n const [fontsReady, setFontsReady] = React.useState(\n () => typeof document === \"undefined\" || document.fonts.status === \"loaded\",\n );\n React.useEffect(() => {\n if (fontsReady || typeof document === \"undefined\") return;\n const handle = delayRender(\"ascii-dissolve: waiting for fonts\");\n let alive = true;\n document.fonts.ready.then(() => {\n if (alive) setFontsReady(true);\n continueRender(handle);\n });\n return () => {\n alive = false;\n continueRender(handle);\n };\n }, [fontsReady]);\n\n const fontSize = cellSize * 0.86;\n const advance = React.useMemo(\n () => measureAdvance(fontFamily, fontSize),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fontFamily, fontSize, fontsReady],\n );\n const cols = Math.ceil(width / advance);\n const rows = Math.ceil(height / cellSize) + 1;\n\n // The zone styles need to know where the incoming text sits — a capsule\n // around its center line, derived from the letterform mask's bounds. The\n // mask itself is never displayed.\n const zoneStyles: AsciiEnterStyle[] = [\"clearing\", \"halo\", \"wave\", \"lime-echo\"];\n const needZone = enterText !== undefined && zoneStyles.includes(enterStyle);\n const enterMask = React.useMemo(\n () =>\n enterText && needZone && fontsReady\n ? buildTextMask(enterText, width, height, cols, rows, advance, cellSize)\n : null,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [enterText, needZone, fontsReady, width, height, cols, rows, advance, cellSize],\n );\n const enterZone = React.useMemo(() => {\n if (enterMask === null) return null;\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (let y = 0; y < rows; y++) {\n for (let x = 0; x < cols; x++) {\n if (enterMask[y * cols + x] > 0) {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n }\n }\n if (maxX < minX) return null;\n return {\n x0: minX * advance,\n x1: (maxX + 1) * advance,\n cy: ((minY + maxY + 1) / 2) * cellSize,\n halfH: ((maxY - minY + 1) / 2) * cellSize,\n };\n }, [enterMask, cols, rows, advance, cellSize]);\n\n if (!entering) {\n const exitStyle: React.CSSProperties = {\n opacity: interpolate(p, exitWindow, [1, 0], clampOpts),\n filter: `blur(${interpolate(p, [exitWindow[0], exitWindow[1] + 0.06], [0, 8], clampOpts)}px)`,\n };\n return <AbsoluteFill style={exitStyle}>{children}</AbsoluteFill>;\n }\n\n // -------------------------------------------------------------------------\n // Envelopes.\n // -------------------------------------------------------------------------\n // Generic mode keeps the original flat envelopes; text mode staggers the\n // rise and the dissolve per cell instead, so nothing moves as one plane.\n const coverage = textMode\n ? 1\n : interpolate(p, [0.06, 0.28, 0.6, 0.9], [0, 1, 1, 0], clampOpts);\n const fieldOpacity = textMode\n ? 1\n : interpolate(p, [0.04, 0.2, 0.66, 0.94], [0, 1, 1, 0], clampOpts);\n const panelOpacity = textMode\n ? interpolate(p, [0.06, 0.24, 0.55, 0.75], [0, 1, 1, 0], clampOpts)\n : fieldOpacity;\n\n // Text-mode phase clocks. The outgoing scene blurs out as the field\n // rises; the field boils, then dissolves cell by cell while the real\n // text fades in.\n const riseG = interpolate(p, [0.04, 0.3], [0, 1], clampOpts);\n const dissolveG = interpolate(\n p,\n enterStyle === \"clearing\" ? [0.52, 0.85] : [0.5, 0.82],\n [0, 1],\n clampOpts,\n );\n\n // Style clocks for the arriving text's surroundings.\n const haloG = interpolate(p, [0.52, 0.74], [0, 1], clampOpts);\n const waveT = interpolate(p, [0.56, 0.94], [0, 1], {\n ...clampOpts,\n easing: Easing.out(Easing.quad),\n });\n const waveR = waveT * 860; // the impulse front, px from the text capsule\n const echoFlash = interpolate(p, [0.56, 0.64, 0.82], [0, 0.9, 0], clampOpts);\n const focusBlur = interpolate(p, [0.55, 0.9], [0, 4], clampOpts);\n const focusFade = interpolate(p, [0.62, 0.94], [1, 0], clampOpts);\n\n const cx = cols / 2;\n const cy = rows / 2;\n const t = p * 5;\n const rampLen = ramp.length;\n\n const mainRows: string[] = [];\n const accentRows: string[] = [];\n const echoRows: string[] = [];\n const fieldAlive = textMode ? p < 0.999 : fieldOpacity > 0.001;\n\n if (fieldAlive) {\n for (let y = 0; y < rows; y++) {\n let mainRow = \"\";\n let accentRow = \"\";\n let echoRow = \"\";\n for (let x = 0; x < cols; x++) {\n // A slow sinusoid flow plus per-cell jitter — organic, but textual.\n const base =\n 0.5 +\n (Math.sin(x * 0.33 + t * 1.7) +\n Math.sin(y * 0.51 - t * 1.2) +\n Math.sin((x * 0.5 + y) * 0.24 + t * 0.9) +\n Math.sin(Math.hypot(x - cx, (y - cy) * 1.8) * 0.42 - t * 2.1)) /\n 8;\n const jitter = random(`ascii-${x}-${y}`);\n\n // Distance to the incoming text's capsule, for the zone styles —\n // and the plain circular distance from its center, for the wave.\n let dist = Infinity;\n let distC = Infinity;\n let s = 0; // proximity, 1 at the text's center line → 0 far away\n if (enterZone !== null) {\n const px = (x + 0.5) * advance;\n const py = (y + 0.5) * cellSize;\n const nx = Math.min(Math.max(px, enterZone.x0), enterZone.x1);\n dist = Math.hypot(px - nx, py - enterZone.cy);\n distC = Math.hypot(px - (enterZone.x0 + enterZone.x1) / 2, py - enterZone.cy);\n s = Math.max(0, 1 - dist / (enterZone.halfH + 64));\n }\n\n let cellCoverage: number;\n if (!textMode) {\n cellCoverage = coverage;\n } else if (enterStyle === \"clearing\" && enterZone !== null) {\n // Dissolve order biased by proximity: cells near the headline\n // vanish first, a granular cavity opens outward.\n const order =\n (1 - s) * 0.6 + random(`ascii-d-${x}-${y}`) * 0.4;\n const gone = Math.max(\n 0,\n Math.min(1, (dissolveG * 1.35 - order) / 0.3),\n );\n cellCoverage = stagger(riseG, jitter) * (1 - gone);\n } else if (enterStyle === \"wave\" && enterZone !== null) {\n // The impulse front — a CIRCLE from the text's center — clears\n // the field behind it.\n const passed = Math.max(0, Math.min(1, (waveR - distC) / 55));\n cellCoverage = stagger(riseG, jitter) * (1 - passed);\n } else {\n cellCoverage =\n stagger(riseG, jitter) *\n (1 - stagger(dissolveG, random(`ascii-d-${x}-${y}`)));\n }\n\n let d = Math.max(\n 0,\n Math.min(0.999, (base * 0.72 + jitter * 0.28) * cellCoverage * 1.2 - 0.08),\n );\n if (enterStyle === \"halo\" && enterZone !== null) {\n // A smooth radial attenuation: near cells slide down the ramp.\n d *= 1 - haloG * s;\n }\n if (enterStyle === \"wave\" && enterZone !== null && waveT > 0) {\n // Cells on the circular wavefront jump up the ramp for a beat.\n const bump = Math.exp(-(((distC - waveR) / 55) ** 2));\n d = Math.min(0.999, d + bump * 0.5);\n }\n const ch = ramp[Math.floor(d * rampLen)] ?? \" \";\n const isAccent =\n accentColor !== undefined && random(`ascii-a-${x}-${y}`) < accentDensity;\n mainRow += isAccent ? \" \" : ch;\n accentRow += isAccent ? ch : \" \";\n\n // The lime echo: a sparse ring of accent glyphs around the headline.\n if (\n enterStyle === \"lime-echo\" &&\n enterZone !== null &&\n echoFlash > 0.01 &&\n dist > 8 &&\n dist < 84 &&\n ch !== \" \" &&\n random(`ascii-e-${x}-${y}`) < 0.5\n ) {\n echoRow += ch;\n } else {\n echoRow += \" \";\n }\n }\n mainRows.push(mainRow);\n accentRows.push(accentRow);\n echoRows.push(echoRow);\n }\n }\n\n // The blur must hit exactly 0 by p = 1: the entering presentation stays\n // mounted at p = 1 for the whole scene, so any residue would soften the\n // incoming scene permanently. In text mode the incoming scene resolves\n // with NO transform at all — it must sit pixel-exact under the letterform.\n const enterBlur = textMode\n ? 0\n : interpolate(p, [enterWindow[0], Math.min(1, enterWindow[1] + 0.05)], [10, 0], clampOpts);\n const childStyle: React.CSSProperties = textMode\n ? { opacity: interpolate(p, enterWindow, [0, 1], clampOpts) }\n : {\n opacity: interpolate(p, enterWindow, [0, 1], clampOpts),\n transform: `scale(${interpolate(p, [enterWindow[0], 1], [1.04, 1], {\n ...clampOpts,\n easing: Easing.out(Easing.cubic),\n })})`,\n filter: enterBlur > 0.01 ? `blur(${enterBlur}px)` : undefined,\n };\n\n const preStyle: React.CSSProperties = {\n margin: 0,\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n whiteSpace: \"pre\",\n fontFamily,\n fontSize,\n lineHeight: `${cellSize}px`,\n color: colorFront,\n };\n\n const renderLayer = (layerRows: string[], color: string, layerOpacity: number) =>\n layerOpacity > 0.001 ? (\n <pre style={{ ...preStyle, color, opacity: layerOpacity }}>\n {layerRows.join(\"\\n\")}\n </pre>\n ) : null;\n\n return (\n <AbsoluteFill>\n <AbsoluteFill style={childStyle}>{children}</AbsoluteFill>\n {fieldAlive ? (\n <AbsoluteFill style={{ pointerEvents: \"none\" }}>\n <AbsoluteFill style={{ background: colorBack, opacity: panelOpacity }} />\n <AbsoluteFill\n style={\n enterStyle === \"focus\" && textMode\n ? {\n opacity: focusFade,\n filter: focusBlur > 0.01 ? `blur(${focusBlur}px)` : undefined,\n }\n : undefined\n }\n >\n {renderLayer(mainRows, colorFront, fieldOpacity)}\n {accentColor !== undefined\n ? renderLayer(accentRows, accentColor, fieldOpacity)\n : null}\n </AbsoluteFill>\n {enterStyle === \"lime-echo\"\n ? renderLayer(echoRows, accentColor ?? \"#C3E88D\", echoFlash)\n : null}\n </AbsoluteFill>\n ) : null}\n </AbsoluteFill>\n );\n};\n\nexport function asciiDissolve(\n props: AsciiDissolveProps = {},\n): TransitionPresentation<AsciiDissolveProps> {\n return {\n component: AsciiDissolvePresentation,\n props,\n };\n}\n",+ "type": "registry:component",+ "target": "components/remocn/ascii-dissolve.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/caret-wipe.json b/registry-artifacts/caret-wipe.jsonnew file mode 100644index 00000000..037cc92e--- /dev/null+++ b/registry-artifacts/caret-wipe.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "caret-wipe",+ "title": "Caret Wipe",+ "description": "Sweep a typing caret across the frame, wiping the outgoing scene into the next.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/caret-wipe/index.tsx",+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, Easing, interpolate } from \"remotion\";\nimport type {\n TransitionPresentation,\n TransitionPresentationComponentProps,\n} from \"@remotion/transitions\";\n\nconst clampOpts = {\n extrapolateLeft: \"clamp\" as const,\n extrapolateRight: \"clamp\" as const,\n};\n\nexport type CaretWipeProps = {\n /** Sweep direction. `right` types the screen left→right; `left` reverses it. */\n direction?: \"left\" | \"right\";\n /** The caret's color — the remocn lime by default. */\n caretColor?: string;\n /** Caret bar width in px. */\n caretWidth?: number;\n /** Caret bar height as a fraction of frame height (0–1), vertically centered. */\n caretHeight?: number;\n};\n\n// ---------------------------------------------------------------------------\n// caret-wipe — a typographic scene transition.\n//\n// A single tall caret (the remocn text cursor) sweeps across the frame in one\n// eased pass. The caret IS the wipe boundary: the region it has PASSED shows\n// the incoming scene (freshly \"typed in\" — it settles down and un-blurs just\n// behind the caret), while the region it has NOT reached still shows the\n// outgoing scene (being \"backspaced\" — it lifts and blurs as it's consumed).\n//\n// Both scenes share whatever backdrop sits behind the TransitionSeries, so the\n// complementary clips never expose a seam. Pure frame-driven interpolate — no\n// CSS keyframes — so it seeks correctly and renders identically every time.\n// ---------------------------------------------------------------------------\nconst CaretWipePresentation: React.FC<\n TransitionPresentationComponentProps<CaretWipeProps>\n> = ({ children, presentationProgress, presentationDirection, passedProps }) => {\n const {\n direction = \"right\",\n caretColor = \"#C3E88D\",\n caretWidth = 3,\n caretHeight = 0.5,\n } = passedProps;\n\n const entering = presentationDirection === \"entering\";\n const p = presentationProgress;\n const goingRight = direction === \"right\";\n\n // Eased sweep so the caret decelerates as it lands the last column.\n const eased = interpolate(p, [0, 1], [0, 1], {\n ...clampOpts,\n easing: Easing.bezier(0.65, 0, 0.35, 1),\n });\n // Caret position as a percent of frame width; the wipe boundary.\n const caretX = goingRight ? eased * 100 : (1 - eased) * 100;\n\n if (!entering) {\n // Outgoing: keep only the column the caret hasn't reached yet, and let it\n // lift + blur as it's consumed (backspaced).\n const keep = goingRight\n ? `inset(0 0 0 ${caretX}%)` // keep the right band [caretX, 100]\n : `inset(0 ${100 - caretX}% 0 0)`; // keep the left band [0, caretX]\n return (\n <AbsoluteFill\n style={{\n clipPath: keep,\n WebkitClipPath: keep,\n transform: `translateY(${interpolate(p, [0, 1], [0, -6], clampOpts)}px)`,\n filter: `blur(${interpolate(p, [0.1, 1], [0, 4], clampOpts)}px)`,\n }}\n >\n {children}\n </AbsoluteFill>\n );\n }\n\n // Incoming: reveal only the column the caret has already passed, and let it\n // settle down + sharpen just behind the caret (typed in).\n const reveal = goingRight\n ? `inset(0 ${100 - caretX}% 0 0)` // reveal the left band [0, caretX]\n : `inset(0 0 0 ${caretX}%)`; // reveal the right band [caretX, 100]\n\n // The caret fades in at the very start and out at the very end so it never\n // pops on/off at the transition's frame edges.\n const caretOpacity = interpolate(\n p,\n [0, 0.08, 0.92, 1],\n [0, 1, 1, 0],\n clampOpts,\n );\n\n return (\n <AbsoluteFill>\n {/* Freshly typed content, clipped to the passed column. */}\n <AbsoluteFill\n style={{\n clipPath: reveal,\n WebkitClipPath: reveal,\n transform: `translateY(${interpolate(p, [0, 1], [3, 0], clampOpts)}px)`,\n filter: `blur(${interpolate(p, [0, 0.8], [2, 0], clampOpts)}px)`,\n }}\n >\n {children}\n </AbsoluteFill>\n\n {/* The caret — drawn on top, unclipped, only in the entering pass so it\n appears exactly once. */}\n <AbsoluteFill style={{ pointerEvents: \"none\", opacity: caretOpacity }}>\n <div\n style={{\n position: \"absolute\",\n left: `${caretX}%`,\n top: `${(1 - caretHeight) * 50}%`,\n height: `${caretHeight * 100}%`,\n width: caretWidth,\n transform: \"translateX(-50%)\",\n background: caretColor,\n borderRadius: caretWidth,\n boxShadow: `0 0 18px ${caretColor}, 0 0 6px ${caretColor}`,\n }}\n />\n </AbsoluteFill>\n </AbsoluteFill>\n );\n};\n\nexport function caretWipe(\n props: CaretWipeProps = {},\n): TransitionPresentation<CaretWipeProps> {\n return {\n component: CaretWipePresentation,\n props,\n };\n}\n",+ "type": "registry:component",+ "target": "components/remocn/caret-wipe.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/icon-scatter.json b/registry-artifacts/icon-scatter.jsonnew file mode 100644index 00000000..87eeb94c--- /dev/null+++ b/registry-artifacts/icon-scatter.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "icon-scatter",+ "title": "Icon Scatter",+ "description": "Scatter a field of icons over the cut, hiding the scene swap at the field's peak.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/icon-scatter/index.tsx",+ "content": "\"use client\";\n\nimport type React from \"react\";\nimport { AbsoluteFill, Easing, interpolate, random } from \"remotion\";\nimport type {\n TransitionPresentation,\n TransitionPresentationComponentProps,\n} from \"@remotion/transitions\";\n\n// ===========================================================================\n// icon-scatter — a scene change made of icons.\n//\n// The outgoing scene shatters into a deterministic field of line-icons that\n// draw themselves on, spin, and scatter outward; at mid-transition the field\n// is densest and covers the swap; then the icons fly off and draw away as the\n// incoming scene resolves through them. Motion-forward and self-contained —\n// the paths are inlined, the draw-on is CSS `pathLength` only, so the\n// transition ships as one file with no icon dependencies.\n//\n// Pace it with `linearTiming`/`springTiming` like any presentation. Reads\n// best over ~16–26 frames.\n// ===========================================================================\n\nconst clampOpts = {\n extrapolateLeft: \"clamp\" as const,\n extrapolateRight: \"clamp\" as const,\n};\n\n// Single-path Lucide-style glyphs (viewBox 0 0 24 24) — each draws cleanly\n// from one continuous stroke via a normalized dashoffset.\nconst ICON_PATHS: string[] = [\n // star\n \"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\",\n // heart\n \"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5\",\n // zap\n \"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\",\n // sparkles\n \"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\",\n // moon\n \"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\",\n // play\n \"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\",\n // crown\n \"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z\",\n // circle\n \"M12 2 A10 10 0 0 1 22 12 A10 10 0 0 1 12 22 A10 10 0 0 1 2 12 A10 10 0 0 1 12 2\",\n // square (rounded)\n \"M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z\",\n // triangle\n \"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3z\",\n // plus\n \"M12 5v14 M5 12h14\",\n];\n\nexport type IconScatterProps = {\n /** How many icons populate the field. Default 15. */\n count?: number;\n /** Icon stroke color. Default near-white ink. */\n color?: string;\n /** The fill that hides the swap at the field's peak. Default warm obsidian. */\n coverColor?: string;\n /** Peak opacity of the cover fill (0–1). Lower = more of the swap shows. */\n coverOpacity?: number;\n /** Stroke width of the icons, in their 24px viewBox units. Default 2. */\n strokeWidth?: number;\n /** How far icons fly on scatter, in px. Default 260. */\n flyDistance?: number;\n /** Seed so two scatters in one video can differ. Default \"icon-scatter\". */\n seed?: string;\n};\n\ntype Placed = {\n path: string;\n xPct: number;\n yPct: number;\n size: number;\n spin: number; // degrees swept over the whole transition\n dir: number; // outward scatter angle offset\n strokeOpacity: number;\n pStart: number; // when this icon begins drawing (p-space)\n pOut: number; // when this icon begins flying out (p-space)\n};\n\n// Jittered grid so the field reads as scattered but never clumps or overlaps.\nfunction placeIcons(count: number, seed: string): Placed[] {\n const cols = Math.ceil(Math.sqrt((count * 16) / 9));\n const rows = Math.ceil(count / cols);\n const out: Placed[] = [];\n for (let i = 0; i < count; i++) {\n const col = i % cols;\n const row = Math.floor(i / cols);\n const cellW = 100 / cols;\n const cellH = 100 / rows;\n const jx = (random(`${seed}-jx-${i}`) - 0.5) * cellW * 0.7;\n const jy = (random(`${seed}-jy-${i}`) - 0.5) * cellH * 0.7;\n out.push({\n path: ICON_PATHS[Math.floor(random(`${seed}-p-${i}`) * ICON_PATHS.length)],\n xPct: cellW * (col + 0.5) + jx,\n yPct: cellH * (row + 0.5) + jy,\n size: 34 + random(`${seed}-s-${i}`) * 40,\n spin: (random(`${seed}-r-${i}`) - 0.5) * 320,\n dir: (random(`${seed}-d-${i}`) - 0.5) * 1.2,\n strokeOpacity: 0.5 + random(`${seed}-o-${i}`) * 0.5,\n pStart: random(`${seed}-a-${i}`) * 0.16,\n pOut: 0.52 + random(`${seed}-b-${i}`) * 0.16,\n });\n }\n return out;\n}\n\nconst IconField: React.FC<{\n p: number;\n placed: Placed[];\n color: string;\n strokeWidth: number;\n flyDistance: number;\n}> = ({ p, placed, color, strokeWidth, flyDistance }) => (\n <AbsoluteFill style={{ pointerEvents: \"none\" }}>\n {placed.map((icon, i) => {\n // Draw on over ~0.34 of p from the icon's start, then fly out.\n const draw = interpolate(p, [icon.pStart, icon.pStart + 0.34], [0, 1], {\n ...clampOpts,\n easing: Easing.out(Easing.cubic),\n });\n const scaleIn = interpolate(p, [icon.pStart, icon.pStart + 0.3], [0.4, 1], {\n ...clampOpts,\n easing: Easing.out(Easing.back(1.6)),\n });\n const outP = interpolate(p, [icon.pOut, 1], [0, 1], {\n ...clampOpts,\n easing: Easing.in(Easing.cubic),\n });\n\n // Scatter outward from the frame center, along the icon's own radial.\n const cx = icon.xPct - 50;\n const cy = icon.yPct - 50;\n const angle = Math.atan2(cy, cx) + icon.dir;\n const fly = outP * flyDistance;\n const tx = Math.cos(angle) * fly;\n const ty = Math.sin(angle) * fly;\n\n const spin = icon.spin * interpolate(p, [icon.pStart, 1], [0, 1], clampOpts);\n const opacity = Math.min(draw, 1 - outP) * icon.strokeOpacity;\n if (opacity <= 0.001) return null;\n\n return (\n <svg\n key={i}\n width={icon.size}\n height={icon.size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{\n position: \"absolute\",\n left: `${icon.xPct}%`,\n top: `${icon.yPct}%`,\n opacity,\n overflow: \"visible\",\n transform: `translate(-50%, -50%) translate(${tx}px, ${ty}px) scale(${\n scaleIn * (1 - outP * 0.3)\n }) rotate(${spin}deg)`,\n }}\n >\n <path\n d={icon.path}\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - draw}\n />\n </svg>\n );\n })}\n </AbsoluteFill>\n);\n\nconst IconScatterPresentation: React.FC<\n TransitionPresentationComponentProps<IconScatterProps>\n> = ({ children, presentationProgress, presentationDirection, passedProps }) => {\n const {\n count = 15,\n color = \"#fafafa\",\n coverColor = \"#0a0a0a\",\n coverOpacity = 0.92,\n strokeWidth = 2,\n flyDistance = 260,\n seed = \"icon-scatter\",\n } = passedProps;\n const entering = presentationDirection === \"entering\";\n const p = presentationProgress;\n\n if (!entering) {\n // The outgoing scene sinks back and blurs as the field rises over it.\n const exitStyle: React.CSSProperties = {\n opacity: interpolate(p, [0.28, 0.5], [1, 0], clampOpts),\n transform: `scale(${interpolate(p, [0, 0.5], [1, 0.94], {\n ...clampOpts,\n easing: Easing.in(Easing.cubic),\n })})`,\n filter: `blur(${interpolate(p, [0.1, 0.45], [0, 10], clampOpts)}px)`,\n };\n return <AbsoluteFill style={exitStyle}>{children}</AbsoluteFill>;\n }\n\n const placed = placeIcons(count, seed);\n\n // The incoming scene resolves once the field starts clearing.\n const childStyle: React.CSSProperties = {\n opacity: interpolate(p, [0.5, 0.68], [0, 1], clampOpts),\n transform: `scale(${interpolate(p, [0.5, 1], [1.06, 1], {\n ...clampOpts,\n easing: Easing.out(Easing.cubic),\n })})`,\n filter: `blur(${interpolate(p, [0.5, 0.72], [8, 0], clampOpts)}px)`,\n };\n\n // The cover fill hides the swap while the field is densest.\n const cover = interpolate(p, [0, 0.3, 0.62, 0.9], [0, 1, 1, 0], clampOpts);\n\n return (\n <AbsoluteFill>\n <AbsoluteFill style={childStyle}>{children}</AbsoluteFill>\n <AbsoluteFill\n style={{\n background: coverColor,\n opacity: cover * coverOpacity,\n pointerEvents: \"none\",\n }}\n />\n <IconField\n p={p}\n placed={placed}\n color={color}\n strokeWidth={strokeWidth}\n flyDistance={flyDistance}\n />\n </AbsoluteFill>\n );\n};\n\nexport function iconScatter(\n props: IconScatterProps = {},\n): TransitionPresentation<IconScatterProps> {\n return {\n component: IconScatterPresentation,\n props,\n };\n}\n",+ "type": "registry:component",+ "target": "components/remocn/icon-scatter.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/reel.json b/registry-artifacts/reel.jsonnew file mode 100644index 00000000..3d5c4a84--- /dev/null+++ b/registry-artifacts/reel.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "reel",+ "title": "Reel",+ "description": "A fixed centered card where images stack on the z-axis and each blooms open over the last via a centre-out mask.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/reel/index.tsx",+ "content": "\"use client\";\n\nimport {\n AbsoluteFill,\n Easing,\n Img,\n interpolate,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\nconst clamp = {\n extrapolateLeft: \"clamp\" as const,\n extrapolateRight: \"clamp\" as const,\n};\nconst EASE_OUT = Easing.out(Easing.cubic);\n\nexport type ReelProps = {\n images: string[];\n width?: number;\n height?: number;\n radius?: number;\n step?: number;\n reveal?: number;\n objectPosition?: string;\n background?: string;\n};\n\nexport function Reel({\n images,\n width = 1180,\n height = 676,\n radius = 16,\n step = 20,\n reveal = 13,\n objectPosition = \"top\",\n background = \"#050506\",\n}: ReelProps) {\n const frame = useCurrentFrame();\n const { width: compWidth, height: compHeight } = useVideoConfig();\n const left = (compWidth - width) / 2;\n const top = (compHeight - height) / 2;\n\n return (\n <AbsoluteFill>\n {images.map((src, i) => {\n const p = interpolate(\n frame,\n [i * step, i * step + reveal],\n [0, 1],\n { ...clamp, easing: EASE_OUT },\n );\n if (p <= 0) return null;\n const inset = (1 - p) * 50;\n const imgScale = interpolate(p, [0, 1], [1.08, 1], clamp);\n return (\n <div\n key={i}\n style={{\n position: \"absolute\",\n left,\n top,\n width,\n height,\n zIndex: i,\n clipPath: `inset(${inset}% ${inset}% round ${radius}px)`,\n WebkitClipPath: `inset(${inset}% ${inset}% round ${radius}px)`,\n background,\n boxShadow: \"0 30px 80px rgba(0,0,0,0.6)\",\n willChange: \"clip-path\",\n }}\n >\n <Img\n src={src}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n objectPosition,\n transform: `scale(${imgScale})`,\n willChange: \"transform\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: radius,\n border: \"1px solid rgba(255,255,255,0.08)\",\n }}\n />\n </div>\n );\n })}\n </AbsoluteFill>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/reel.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.jsonindex 81bebeeb..7553804c 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -1475,6 +1475,118 @@],"type": "registry:lib"},+ {+ "name": "ascii-dissolve",+ "title": "ASCII Dissolve",+ "description": "Dissolve one scene into the next through a drifting field of ASCII glyphs.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/ascii-dissolve/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/ascii-dissolve.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "caret-wipe",+ "title": "Caret Wipe",+ "description": "Sweep a typing caret across the frame, wiping the outgoing scene into the next.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/caret-wipe/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/caret-wipe.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "icon-scatter",+ "title": "Icon Scatter",+ "description": "Scatter a field of icons over the cut, hiding the scene swap at the field's peak.",+ "dependencies": ["remotion", "@remotion/transitions"],+ "files": [+ {+ "path": "registry/remocn/icon-scatter/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/icon-scatter.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "shader-caustics",+ "title": "Shader Caustics",+ "description": "A field of refracted light — the bright filaments light makes through a rippling surface.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-caustics/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-caustics.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "shader-gem-smoke",+ "title": "Shader Gem Smoke",+ "description": "Paper's Gem Smoke shader driven by the frame — smoke flowing behind and inside a glassy logo.",+ "dependencies": ["@paper-design/shaders-react"],+ "files": [+ {+ "path": "registry/remocn/shader-gem-smoke/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-gem-smoke.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "shader-strata",+ "title": "Shader Strata",+ "description": "Fine horizontal sediment layers displaced by fbm noise, each drifting at its own depth.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-strata/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-strata.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "shader-weave",+ "title": "Shader Weave",+ "description": "A woven substrate of warp and weft threads crossing on a domain-warped grid, with a travelling sheen.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-weave/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-weave.tsx"+ }+ ],+ "type": "registry:component"+ },+ {+ "name": "reel",+ "title": "Reel",+ "description": "A fixed centered card where images stack on the z-axis and each blooms open over the last via a centre-out mask.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/reel/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/reel.tsx"+ }+ ],+ "type": "registry:component"+ },{"name": "remocn-ui","title": "remocn UI Core",diff --git a/registry-artifacts/shader-caustics.json b/registry-artifacts/shader-caustics.jsonnew file mode 100644index 00000000..ccfaee8a--- /dev/null+++ b/registry-artifacts/shader-caustics.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "shader-caustics",+ "title": "Shader Caustics",+ "description": "A field of refracted light — the bright filaments light makes through a rippling surface.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-caustics/index.tsx",+ "content": "\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n continueRender,\n delayRender,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\n// A field of refracted light — caustics. The web of bright filaments light\n// makes when it passes through a surface and lands on the floor beneath.\n// Written for the remocn registry as a custom WebGL shader (not a\n// paper-design wrapper): frame-driven, deterministic, no wall-clock time.\n//\n// The filaments are slightly denser and brighter toward the bottom of the\n// frame — the light lands on the base — which makes it a natural carrier for\n// foundation stories. `accent` / `accentAmount` tint the filaments themselves\n// (not the floor), so an undertone can arrive mid-video by animating\n// `accentAmount` from the master timeline and stay in the light afterwards.\n\nexport interface ShaderCausticsProps {\n /** [floor color, filament light color]. */\n colors?: [string, string];\n /** Tint mixed into the bright filaments. */\n accent?: string;\n /** 0..1 — how much of the accent the filaments take. */\n accentAmount?: number;\n /** Spatial frequency of the light web. */\n scale?: number;\n /** Overall brightness of the filaments. */\n intensity?: number;\n /** Global time multiplier. */\n speed?: number;\n className?: string;\n}\n\nconst VERT = `\nattribute vec2 a_pos;\nvoid main() {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n}\n`;\n\nconst FRAG = `\nprecision highp float;\n\nuniform vec2 u_res;\nuniform float u_time;\nuniform float u_scale;\nuniform float u_intensity;\nuniform vec3 u_floor;\nuniform vec3 u_light;\nuniform vec3 u_accent;\nuniform float u_accentAmt;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_res;\n float aspect = u_res.x / u_res.y;\n vec2 p = vec2(uv.x * aspect, uv.y) * u_scale;\n\n // Iterative trigonometric warp: each pass bends the sample point by the\n // previous pass, and the reciprocal distance to the warped axes\n // accumulates into the caustic web.\n float t = u_time * 0.35;\n vec2 i = p;\n float c = 0.0;\n for (int n = 0; n < 4; n++) {\n float phase = t * (1.0 - 3.2 / float(n + 2));\n i = p + vec2(\n cos(phase - i.x) + sin(phase + i.y),\n sin(phase - i.y) + cos(phase + i.x)\n );\n c += 1.0 / length(vec2(\n p.x / (sin(i.x + phase) * 90.0),\n p.y / (cos(i.y + phase) * 90.0)\n ));\n }\n c /= 4.0;\n c = 1.24 - pow(abs(c), 1.35);\n // |c| collapses to zero along thin branching veins — that zero-crossing\n // set IS the caustic web. Light the veins with an exponential falloff\n // (sharp core + a soft halo) and leave everything else near-black.\n float web = exp(-abs(c) * 0.5) + 0.22 * exp(-abs(c) * 0.12);\n web = web / (1.0 + 0.6 * web);\n\n // The light lands on the base: filaments read stronger low in the frame.\n float ground = mix(1.25, 0.55, uv.y);\n web *= ground * u_intensity;\n\n // Vignette keeps the corners quiet so type always wins.\n vec2 v = uv - 0.5;\n float vig = 1.0 - dot(v, v) * 1.1;\n web *= clamp(vig, 0.0, 1.0);\n\n vec3 filament = mix(u_light, u_accent, clamp(u_accentAmt, 0.0, 1.0));\n vec3 col = u_floor + filament * web;\n\n // A whisper of living grain, time-derived so it stays deterministic.\n col += (hash(gl_FragCoord.xy + floor(u_time * 9.0)) - 0.5) * 0.012;\n\n gl_FragColor = vec4(col, 1.0);\n}\n`;\n\nconst hexToRgb = (hex: string): [number, number, number] => {\n const h = hex.replace(\"#\", \"\");\n const v =\n h.length === 3\n ? h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n : h;\n const n = parseInt(v, 16);\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n};\n\ntype GlState = {\n gl: WebGLRenderingContext;\n uniforms: Record<string, WebGLUniformLocation | null>;\n};\n\nexport function ShaderCaustics({\n colors = [\"#0a0a0a\", \"#2e2e33\"],\n accent = \"#7F57FF\",\n accentAmount = 0,\n scale = 5.2,\n intensity = 1,\n speed = 1,\n className,\n}: ShaderCausticsProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const stateRef = useRef<GlState | null>(null);\n const [handle] = useState(() => delayRender(\"shader-caustics\"));\n const continuedRef = useRef(false);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas || stateRef.current) return;\n const gl = canvas.getContext(\"webgl\", {\n antialias: false,\n preserveDrawingBuffer: true,\n });\n if (!gl) return;\n\n const compile = (type: number, src: string) => {\n const shader = gl.createShader(type)!;\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n };\n const program = gl.createProgram()!;\n gl.attachShader(program, compile(gl.VERTEX_SHADER, VERT));\n gl.attachShader(program, compile(gl.FRAGMENT_SHADER, FRAG));\n gl.linkProgram(program);\n gl.useProgram(program);\n\n const buf = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buf);\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array([-1, -1, 3, -1, -1, 3]),\n gl.STATIC_DRAW,\n );\n const loc = gl.getAttribLocation(program, \"a_pos\");\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);\n\n const uniforms: GlState[\"uniforms\"] = {};\n for (const name of [\n \"u_res\",\n \"u_time\",\n \"u_scale\",\n \"u_intensity\",\n \"u_floor\",\n \"u_light\",\n \"u_accent\",\n \"u_accentAmt\",\n ]) {\n uniforms[name] = gl.getUniformLocation(program, name);\n }\n stateRef.current = { gl, uniforms };\n }, []);\n\n useEffect(() => {\n const state = stateRef.current;\n const canvas = canvasRef.current;\n if (!state || !canvas) return;\n const { gl, uniforms } = state;\n\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniforms.u_res, canvas.width, canvas.height);\n gl.uniform1f(uniforms.u_time, (frame / fps) * speed);\n gl.uniform1f(uniforms.u_scale, scale);\n gl.uniform1f(uniforms.u_intensity, intensity);\n gl.uniform3fv(uniforms.u_floor, hexToRgb(colors[0]));\n gl.uniform3fv(uniforms.u_light, hexToRgb(colors[1]));\n gl.uniform3fv(uniforms.u_accent, hexToRgb(accent));\n gl.uniform1f(uniforms.u_accentAmt, accentAmount);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n if (!continuedRef.current) {\n continuedRef.current = true;\n requestAnimationFrame(() =>\n requestAnimationFrame(() => continueRender(handle)),\n );\n }\n }, [\n frame,\n fps,\n speed,\n scale,\n intensity,\n colors,\n accent,\n accentAmount,\n handle,\n ]);\n\n return (\n <div className={className} style={{ position: \"absolute\", inset: 0 }}>\n <canvas\n ref={canvasRef}\n width={width}\n height={height}\n style={{ width: \"100%\", height: \"100%\", display: \"block\" }}\n />\n </div>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/shader-caustics.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/shader-gem-smoke.json b/registry-artifacts/shader-gem-smoke.jsonnew file mode 100644index 00000000..d6dd786d--- /dev/null+++ b/registry-artifacts/shader-gem-smoke.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "shader-gem-smoke",+ "title": "Shader Gem Smoke",+ "description": "Paper's Gem Smoke shader driven by the frame — smoke flowing behind and inside a glassy logo.",+ "dependencies": ["@paper-design/shaders-react"],+ "files": [+ {+ "path": "registry/remocn/shader-gem-smoke/index.tsx",+ "content": "\"use client\";\n\nimport { GemSmoke, type GemSmokeProps } from \"@paper-design/shaders-react\";\nimport React, { useCallback, useState } from \"react\";\nimport {\n continueRender,\n delayRender,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\nconst NEUTRAL_COLORS = [\"#3a3a5c\", \"#52527a\"];\n\nexport interface ShaderGemSmokeProps extends Omit<\n GemSmokeProps,\n \"frame\" | \"ref\"\n> {}\n\n/**\n * Paper's Gem Smoke shader, driven deterministically by the current frame.\n *\n * Animated color fields placed over a logo shape — smoke lives behind (and\n * inside) the glassy silhouette. Feed it a brand mark via `image` (a URL,\n * e.g. staticFile('prisma/symbol-light.svg')); the shape is processed once\n * and cached, so every frame renders the same smoke at the same time.\n */\nexport function ShaderGemSmoke({\n speed = 1,\n colors = NEUTRAL_COLORS,\n colorBack = \"#0a0a10\",\n innerDistortion = 0.8,\n outerDistortion = 0.6,\n outerGlow = 0.55,\n innerGlow = 1,\n size = 0.8,\n className,\n ...rest\n}: ShaderGemSmokeProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n\n const [handle] = useState(() => delayRender(\"shader-gem-smoke\"));\n const gate = useCallback(\n (element: HTMLDivElement | null) => {\n if (!element) return;\n requestAnimationFrame(() =>\n requestAnimationFrame(() => continueRender(handle)),\n );\n },\n [handle],\n );\n\n return (\n <div\n ref={gate}\n className={className}\n style={{ position: \"absolute\", inset: 0 }}\n >\n <React.Suspense fallback={null}>\n <GemSmoke\n speed={0}\n frame={(frame / fps) * speed * 1000}\n colors={colors}\n colorBack={colorBack}\n innerDistortion={innerDistortion}\n outerDistortion={outerDistortion}\n outerGlow={outerGlow}\n innerGlow={innerGlow}\n size={size}\n fit=\"cover\"\n width={width}\n height={height}\n suspendWhenProcessingImage\n {...rest}\n />\n </React.Suspense>\n </div>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/shader-gem-smoke.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/shader-strata.json b/registry-artifacts/shader-strata.jsonnew file mode 100644index 00000000..0d3dc781--- /dev/null+++ b/registry-artifacts/shader-strata.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "shader-strata",+ "title": "Shader Strata",+ "description": "Fine horizontal sediment layers displaced by fbm noise, each drifting at its own depth.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-strata/index.tsx",+ "content": "\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n continueRender,\n delayRender,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\n// A field of fine horizontal sediment layers — strata. Each layer's edge is\n// displaced by fbm noise and drifts at its own depth speed, so the stack reads\n// as a living foundation rather than a gradient. Written for the remocn\n// registry as a custom WebGL shader (not a paper-design wrapper): frame-driven,\n// deterministic, no wall-clock time anywhere.\n//\n// `accent` / `accentAmount` tint the DEEP strata (the bottom of the frame) —\n// the layers everything else stands on — which is what makes it a natural\n// carrier for \"base\" stories: the undertone can arrive mid-video by animating\n// `accentAmount` with the master timeline.\n\nexport interface ShaderStrataProps {\n /** Palette from the deepest layer to the surface layer. Exactly 4 stops. */\n colors?: [string, string, string, string];\n /** Tint mixed into the deep strata. */\n accent?: string;\n /** 0..1 — how much of the accent the deep strata take. */\n accentAmount?: number;\n /** Number of strata bands across the frame height. */\n layers?: number;\n /** Edge waviness of each layer, in fractions of the frame height. */\n amplitude?: number;\n /** Global time multiplier. */\n speed?: number;\n className?: string;\n}\n\nconst VERT = `\nattribute vec2 a_pos;\nvoid main() {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n}\n`;\n\nconst FRAG = `\nprecision highp float;\n\nuniform vec2 u_res;\nuniform float u_time;\nuniform float u_layers;\nuniform float u_amp;\nuniform vec3 u_c0;\nuniform vec3 u_c1;\nuniform vec3 u_c2;\nuniform vec3 u_c3;\nuniform vec3 u_accent;\nuniform float u_accentAmt;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n}\n\nfloat noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),\n mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),\n u.y\n );\n}\n\nfloat fbm(vec2 p) {\n float v = 0.0;\n float a = 0.5;\n for (int i = 0; i < 4; i++) {\n v += a * noise(p);\n p *= 2.03;\n a *= 0.5;\n }\n return v;\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_res;\n float aspect = u_res.x / u_res.y;\n\n // Deeper layers drift faster — parallax without per-band recursion.\n float drift = u_time * (0.012 + 0.05 * (1.0 - uv.y));\n float w = fbm(vec2(uv.x * 2.6 * aspect + drift, uv.y * 2.2 - u_time * 0.01));\n\n float yd = uv.y + (w - 0.5) * u_amp;\n float band = yd * u_layers;\n float idx = floor(band);\n float f = fract(band);\n\n // Per-band value jitter + a soft sediment shadow at each band's lower edge.\n float j = hash(vec2(idx, 7.0));\n float edge = smoothstep(0.0, 0.4, f) * (1.0 - 0.3 * smoothstep(0.8, 1.0, f));\n\n float depth = clamp(idx / u_layers, 0.0, 1.0);\n vec3 col = mix(u_c0, u_c1, smoothstep(0.0, 0.4, depth));\n col = mix(col, u_c2, smoothstep(0.35, 0.75, depth));\n col = mix(col, u_c3, smoothstep(0.7, 1.0, depth));\n col *= 0.84 + 0.16 * j;\n col *= 0.92 + 0.08 * edge;\n\n // The accent rises from the deep strata and thins toward the surface.\n float mask = (1.0 - uv.y);\n mask *= mask;\n col = mix(col, u_accent, clamp(u_accentAmt, 0.0, 1.0) * mask * 0.38);\n\n // A whisper of living grain, time-derived so it stays deterministic.\n col += (hash(gl_FragCoord.xy + floor(u_time * 9.0)) - 0.5) * 0.012;\n\n gl_FragColor = vec4(col, 1.0);\n}\n`;\n\nconst hexToRgb = (hex: string): [number, number, number] => {\n const h = hex.replace(\"#\", \"\");\n const v =\n h.length === 3\n ? h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n : h;\n const n = parseInt(v, 16);\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n};\n\ntype GlState = {\n gl: WebGLRenderingContext;\n uniforms: Record<string, WebGLUniformLocation | null>;\n};\n\nexport function ShaderStrata({\n colors = [\"#050507\", \"#0a0a0d\", \"#111014\", \"#17161b\"],\n accent = \"#6733FF\",\n accentAmount = 0,\n layers = 14,\n amplitude = 0.16,\n speed = 1,\n className,\n}: ShaderStrataProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const stateRef = useRef<GlState | null>(null);\n const [handle] = useState(() => delayRender(\"shader-strata\"));\n const continuedRef = useRef(false);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas || stateRef.current) return;\n const gl = canvas.getContext(\"webgl\", {\n antialias: false,\n preserveDrawingBuffer: true,\n });\n if (!gl) return;\n\n const compile = (type: number, src: string) => {\n const shader = gl.createShader(type)!;\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n };\n const program = gl.createProgram()!;\n gl.attachShader(program, compile(gl.VERTEX_SHADER, VERT));\n gl.attachShader(program, compile(gl.FRAGMENT_SHADER, FRAG));\n gl.linkProgram(program);\n gl.useProgram(program);\n\n const buf = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buf);\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array([-1, -1, 3, -1, -1, 3]),\n gl.STATIC_DRAW,\n );\n const loc = gl.getAttribLocation(program, \"a_pos\");\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);\n\n const uniforms: GlState[\"uniforms\"] = {};\n for (const name of [\n \"u_res\",\n \"u_time\",\n \"u_layers\",\n \"u_amp\",\n \"u_c0\",\n \"u_c1\",\n \"u_c2\",\n \"u_c3\",\n \"u_accent\",\n \"u_accentAmt\",\n ]) {\n uniforms[name] = gl.getUniformLocation(program, name);\n }\n stateRef.current = { gl, uniforms };\n }, []);\n\n useEffect(() => {\n const state = stateRef.current;\n const canvas = canvasRef.current;\n if (!state || !canvas) return;\n const { gl, uniforms } = state;\n\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniforms.u_res, canvas.width, canvas.height);\n gl.uniform1f(uniforms.u_time, (frame / fps) * speed);\n gl.uniform1f(uniforms.u_layers, layers);\n gl.uniform1f(uniforms.u_amp, amplitude);\n gl.uniform3fv(uniforms.u_c0, hexToRgb(colors[0]));\n gl.uniform3fv(uniforms.u_c1, hexToRgb(colors[1]));\n gl.uniform3fv(uniforms.u_c2, hexToRgb(colors[2]));\n gl.uniform3fv(uniforms.u_c3, hexToRgb(colors[3]));\n gl.uniform3fv(uniforms.u_accent, hexToRgb(accent));\n gl.uniform1f(uniforms.u_accentAmt, accentAmount);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n if (!continuedRef.current) {\n continuedRef.current = true;\n requestAnimationFrame(() =>\n requestAnimationFrame(() => continueRender(handle)),\n );\n }\n }, [frame, fps, speed, layers, amplitude, colors, accent, accentAmount, handle]);\n\n return (\n <div className={className} style={{ position: \"absolute\", inset: 0 }}>\n <canvas\n ref={canvasRef}\n width={width}\n height={height}\n style={{ width: \"100%\", height: \"100%\", display: \"block\" }}\n />\n </div>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/shader-strata.tsx"+ }+ ],+ "type": "registry:component"+}diff --git a/registry-artifacts/shader-weave.json b/registry-artifacts/shader-weave.jsonnew file mode 100644index 00000000..0a8d6135--- /dev/null+++ b/registry-artifacts/shader-weave.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "shader-weave",+ "title": "Shader Weave",+ "description": "A woven substrate of warp and weft threads crossing on a domain-warped grid, with a travelling sheen.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "registry/remocn/shader-weave/index.tsx",+ "content": "\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n continueRender,\n delayRender,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\n\n// A woven substrate — warp and weft threads crossing on a domain-warped grid,\n// interlacing over/under like real cloth, with a slow sheen of light travelling\n// across the fabric rather than the grid scrolling. The metaphor: the base a\n// component is woven from. Written for the remocn registry as a custom WebGL\n// shader (not a paper-design wrapper): frame-driven, deterministic, no\n// wall-clock time anywhere.\n//\n// `accent` / `accentAmount` run a coloured thread through the weave — the tint\n// lives mostly IN the threads, so raising `accentAmount` mid-video reads as a\n// violet thread lighting up across the whole cloth (a natural carrier for a\n// \"new base\" story). The grid itself never moves; only the light does.\n\nexport interface ShaderWeaveProps {\n /** Palette: fabric-shadow, fabric-mid, fabric-warm, thread-highlight. 4 stops. */\n colors?: [string, string, string, string];\n /** Tint carried by the threads. */\n accent?: string;\n /** 0..1 — how much accent the threads take. */\n accentAmount?: number;\n /** Thread density across the frame height. */\n scale?: number;\n /** Domain-warp amount — how hand-woven the threads bend (fractions of frame). */\n warp?: number;\n /** Global time multiplier (drives only the sheen, never the grid position). */\n speed?: number;\n className?: string;\n}\n\nconst VERT = `\nattribute vec2 a_pos;\nvoid main() {\n gl_Position = vec4(a_pos, 0.0, 1.0);\n}\n`;\n\nconst FRAG = `\nprecision highp float;\n\nuniform vec2 u_res;\nuniform float u_time;\nuniform float u_scale;\nuniform float u_warp;\nuniform vec3 u_c0;\nuniform vec3 u_c1;\nuniform vec3 u_c2;\nuniform vec3 u_c3;\nuniform vec3 u_accent;\nuniform float u_accentAmt;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n}\n\nfloat noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),\n mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),\n u.y\n );\n}\n\nfloat fbm(vec2 p) {\n float v = 0.0;\n float a = 0.5;\n for (int i = 0; i < 4; i++) {\n v += a * noise(p);\n p *= 2.03;\n a *= 0.5;\n }\n return v;\n}\n\n// A thin ridge line at every integer of x — the profile of one thread.\nfloat thread(float x, float sharp) {\n float f = fract(x);\n float d = min(f, 1.0 - f);\n return smoothstep(sharp, 0.0, d);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / u_res;\n float aspect = u_res.x / u_res.y;\n\n // Domain warp — bend the weave so it reads hand-made, not a CSS grid. The\n // warp field drifts very slowly; the grid lattice itself stays put.\n vec2 q = uv + u_warp * vec2(\n fbm(uv * 3.0 + vec2(u_time * 0.03, 0.0)) - 0.5,\n fbm(uv * 3.0 + vec2(7.3, -u_time * 0.02)) - 0.5\n );\n\n float qx = q.x * u_scale * aspect;\n float qy = q.y * u_scale;\n\n float tw = thread(qx, 0.09); // warp (vertical threads)\n float tf = thread(qy, 0.09); // weft (horizontal threads)\n\n // Interlace: per cell, one direction sits over the other.\n float over = mod(floor(qx) + floor(qy), 2.0);\n float warpB = tw * (over < 0.5 ? 1.0 : 0.5);\n float weftB = tf * (over < 0.5 ? 0.5 : 1.0);\n float weave = max(warpB, weftB);\n\n // Sheen — light travelling across a still cloth (this is the only motion).\n float sheen = fbm(q * 1.7 + vec2(u_time * 0.05, u_time * 0.028));\n weave *= 0.3 + 0.95 * sheen;\n\n // Fabric ground: near-black, faintly breathing between the shadow stops.\n vec3 base = mix(u_c0, u_c1, smoothstep(0.15, 0.8, sheen));\n base = mix(base, u_c2, smoothstep(0.62, 1.0, sheen) * 0.5);\n\n // Threads sit a touch above the ground.\n vec3 col = mix(base, u_c3, clamp(weave, 0.0, 1.0) * 0.55);\n\n // The accent runs through the threads — a violet thread across the cloth.\n float amt = clamp(u_accentAmt, 0.0, 1.0);\n col = mix(col, u_accent, amt * (0.08 + 0.34 * weave));\n col += u_accent * amt * 0.015;\n\n // A whisper of living grain, time-derived so it stays deterministic.\n col += (hash(gl_FragCoord.xy + floor(u_time * 9.0)) - 0.5) * 0.012;\n\n gl_FragColor = vec4(col, 1.0);\n}\n`;\n\nconst hexToRgb = (hex: string): [number, number, number] => {\n const h = hex.replace(\"#\", \"\");\n const v =\n h.length === 3\n ? h\n .split(\"\")\n .map((c) => c + c)\n .join(\"\")\n : h;\n const n = parseInt(v, 16);\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n};\n\ntype GlState = {\n gl: WebGLRenderingContext;\n uniforms: Record<string, WebGLUniformLocation | null>;\n};\n\nexport function ShaderWeave({\n colors = [\"#050506\", \"#0a0a0c\", \"#111015\", \"#1b1a22\"],\n accent = \"#6733FF\",\n accentAmount = 0,\n scale = 22,\n warp = 0.03,\n speed = 1,\n className,\n}: ShaderWeaveProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const stateRef = useRef<GlState | null>(null);\n const [handle] = useState(() => delayRender(\"shader-weave\"));\n const continuedRef = useRef(false);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n if (!canvas || stateRef.current) return;\n const gl = canvas.getContext(\"webgl\", {\n antialias: false,\n preserveDrawingBuffer: true,\n });\n if (!gl) return;\n\n const compile = (type: number, src: string) => {\n const shader = gl.createShader(type)!;\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n };\n const program = gl.createProgram()!;\n gl.attachShader(program, compile(gl.VERTEX_SHADER, VERT));\n gl.attachShader(program, compile(gl.FRAGMENT_SHADER, FRAG));\n gl.linkProgram(program);\n gl.useProgram(program);\n\n const buf = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buf);\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array([-1, -1, 3, -1, -1, 3]),\n gl.STATIC_DRAW,\n );\n const loc = gl.getAttribLocation(program, \"a_pos\");\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);\n\n const uniforms: GlState[\"uniforms\"] = {};\n for (const name of [\n \"u_res\",\n \"u_time\",\n \"u_scale\",\n \"u_warp\",\n \"u_c0\",\n \"u_c1\",\n \"u_c2\",\n \"u_c3\",\n \"u_accent\",\n \"u_accentAmt\",\n ]) {\n uniforms[name] = gl.getUniformLocation(program, name);\n }\n stateRef.current = { gl, uniforms };\n }, []);\n\n useEffect(() => {\n const state = stateRef.current;\n const canvas = canvasRef.current;\n if (!state || !canvas) return;\n const { gl, uniforms } = state;\n\n gl.viewport(0, 0, canvas.width, canvas.height);\n gl.uniform2f(uniforms.u_res, canvas.width, canvas.height);\n gl.uniform1f(uniforms.u_time, (frame / fps) * speed);\n gl.uniform1f(uniforms.u_scale, scale);\n gl.uniform1f(uniforms.u_warp, warp);\n gl.uniform3fv(uniforms.u_c0, hexToRgb(colors[0]));\n gl.uniform3fv(uniforms.u_c1, hexToRgb(colors[1]));\n gl.uniform3fv(uniforms.u_c2, hexToRgb(colors[2]));\n gl.uniform3fv(uniforms.u_c3, hexToRgb(colors[3]));\n gl.uniform3fv(uniforms.u_accent, hexToRgb(accent));\n gl.uniform1f(uniforms.u_accentAmt, accentAmount);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n if (!continuedRef.current) {\n continuedRef.current = true;\n requestAnimationFrame(() =>\n requestAnimationFrame(() => continueRender(handle)),\n );\n }\n }, [frame, fps, speed, scale, warp, colors, accent, accentAmount, handle]);\n\n return (\n <div className={className} style={{ position: \"absolute\", inset: 0 }}>\n <canvas\n ref={canvasRef}\n width={width}\n height={height}\n style={{ width: \"100%\", height: \"100%\", display: \"block\" }}\n />\n </div>\n );\n}\n",+ "type": "registry:component",+ "target": "components/remocn/shader-weave.tsx"+ }+ ],+ "type": "registry:component"+}