Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: shader warp
dev_wandry48faf8b0eb96
diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdxindex 5083a931..b9b404b2 100644--- a/content/docs/shaders/index.mdx+++ b/content/docs/shaders/index.mdx@@ -25,3 +25,16 @@ Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apac},]}/>++## Flow++<ComponentCardGrid+ items={[+ {+ name: "ShaderWarp",+ description: "Domain-warped color field that folds and stretches like liquid",+ status: "stable",+ href: "/docs/shaders/shader-warp",+ },+ ]}+/>diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.jsonindex ce918565..8e35684f 100644--- a/content/docs/shaders/meta.json+++ b/content/docs/shaders/meta.json@@ -1,5 +1,10 @@{"title": "Shaders","collapsible": false,- "pages": ["index", "shader-mesh-gradient", "shader-grain-gradient"]+ "pages": [+ "index",+ "shader-mesh-gradient",+ "shader-grain-gradient",+ "shader-warp"+ ]}diff --git a/content/docs/shaders/shader-warp.mdx b/content/docs/shaders/shader-warp.mdxnew file mode 100644index 00000000..6c4c0adb--- /dev/null+++ b/content/docs/shaders/shader-warp.mdx@@ -0,0 +1,37 @@+---+title: Shader Warp+description: Domain-warped color field that folds and stretches like liquid+---++<ComponentPreview name="shader-warp" />++## Installation++<InstallBlock name="shader-warp" />++## Usage++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { ShaderWarp } from "@/components/remocn/shader-warp";++const ShaderWarpScene = () => (+ <ShaderWarp speed={1} distortion={0.2} swirl={0.4} />+);++export const RemotionRoot = () => (+ <Composition+ id="ShaderWarp"+ component={ShaderWarpScene}+ durationInFrames={150}+ fps={30}+ width={1280}+ height={720}+ />+);+```++## Credits++Shader by [paper-design/shaders](https://github.com/paper-design/shaders) (Apache-2.0).diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex f69f8b76..663cc570 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -85,6 +85,8 @@ import { ShaderGrainGradient } from "@/registry/remocn/shader-grain-gradient";import { shaderGrainGradientConfig } from "@/registry/remocn/shader-grain-gradient/config";import { ShaderMeshGradient } from "@/registry/remocn/shader-mesh-gradient";import { shaderMeshGradientConfig } from "@/registry/remocn/shader-mesh-gradient/config";+import { ShaderWarp } from "@/registry/remocn/shader-warp";+import { shaderWarpConfig } from "@/registry/remocn/shader-warp/config";import { NumberWheel } from "@/registry/remocn/number-wheel";import { numberWheelConfig } from "@/registry/remocn/number-wheel/config";import { PerspectiveMarquee } from "@/registry/remocn/perspective-marquee";@@ -320,6 +322,10 @@ const registry: Record<string, RegistryEntry> = {Component: ShaderGrainGradient,config: shaderGrainGradientConfig,},+ "shader-warp": {+ Component: ShaderWarp,+ config: shaderWarpConfig,+ },"dynamic-grid": { Component: DynamicGrid, config: dynamicGridConfig },"simulated-cursor": {Component: SimulatedCursor,diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex 32cb70b2..ea324d5c 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -519,6 +519,22 @@}]},+ {+ "name": "shader-warp",+ "type": "registry:component",+ "title": "Shader Warp",+ "description": "Domain-warped color field that folds and stretches like liquid.",+ "dependencies": [+ "@paper-design/shaders-react"+ ],+ "files": [+ {+ "path": "shader-warp/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-warp.tsx"+ }+ ]+ },{"name": "dynamic-grid","type": "registry:component",diff --git a/registry/remocn/shader-warp/config.ts b/registry/remocn/shader-warp/config.tsnew file mode 100644index 00000000..062c8d2c--- /dev/null+++ b/registry/remocn/shader-warp/config.ts@@ -0,0 +1,52 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const shaderWarpConfig: ComponentConfig = {+ componentName: "ShaderWarp",+ importPath: "@/components/remocn/shader-warp",+ controls: {+ speed: {+ type: "number",+ default: 1,+ min: 0.1,+ max: 4,+ step: 0.1,+ label: "Speed",+ },+ distortion: {+ type: "number",+ default: 0.2,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Distortion",+ },+ swirl: {+ type: "number",+ default: 0.4,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Swirl",+ },+ softness: {+ type: "number",+ default: 1,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Softness",+ },+ proportion: {+ type: "number",+ default: 0.5,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Proportion",+ },+ },+ durationInFrames: 150,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+};diff --git a/registry/remocn/shader-warp/index.tsx b/registry/remocn/shader-warp/index.tsxnew file mode 100644index 00000000..3b2ca44b--- /dev/null+++ b/registry/remocn/shader-warp/index.tsx@@ -0,0 +1,59 @@+"use client";++import { Warp, type WarpProps } from "@paper-design/shaders-react";+import { useCallback, useState } from "react";+import {+ continueRender,+ delayRender,+ useCurrentFrame,+ useVideoConfig,+} from "remotion";++const NEUTRAL_COLORS = ["#12121a", "#3a3a5c", "#12121a", "#52527a"];++export interface ShaderWarpProps extends Omit<WarpProps, "frame" | "ref"> {}++export function ShaderWarp({+ speed = 1,+ colors = NEUTRAL_COLORS,+ proportion = 0.5,+ softness = 1,+ distortion = 0.2,+ swirl = 0.4,+ className,+ ...rest+}: ShaderWarpProps) {+ const frame = useCurrentFrame();+ const { fps } = useVideoConfig();++ const [handle] = useState(() => delayRender("shader-warp"));+ const gate = useCallback(+ (element: HTMLDivElement | null) => {+ if (!element) return;+ requestAnimationFrame(() =>+ requestAnimationFrame(() => continueRender(handle)),+ );+ },+ [handle],+ );++ return (+ <div+ ref={gate}+ className={className}+ style={{ position: "absolute", inset: 0 }}+ >+ <Warp+ speed={0}+ frame={(frame / fps) * speed * 1000}+ colors={colors}+ proportion={proportion}+ softness={softness}+ distortion={distortion}+ swirl={swirl}+ style={{ width: "100%", height: "100%" }}+ {...rest}+ />+ </div>+ );+}