Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: shader swirl
dev_wandryc21d18732f10
diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdxindex b9b404b2..9ac2ed92 100644--- a/content/docs/shaders/index.mdx+++ b/content/docs/shaders/index.mdx@@ -36,5 +36,11 @@ Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apacstatus: "stable",href: "/docs/shaders/shader-warp",},+ {+ name: "ShaderSwirl",+ description: "Concentric bands swirling around a center point",+ status: "stable",+ href: "/docs/shaders/shader-swirl",+ },]}/>diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.jsonindex 8e35684f..8712edc0 100644--- a/content/docs/shaders/meta.json+++ b/content/docs/shaders/meta.json@@ -5,6 +5,7 @@"index","shader-mesh-gradient","shader-grain-gradient",- "shader-warp"+ "shader-warp",+ "shader-swirl"]}diff --git a/content/docs/shaders/shader-swirl.mdx b/content/docs/shaders/shader-swirl.mdxnew file mode 100644index 00000000..f66586f0--- /dev/null+++ b/content/docs/shaders/shader-swirl.mdx@@ -0,0 +1,37 @@+---+title: Shader Swirl+description: Concentric bands swirling around a center point+---++<ComponentPreview name="shader-swirl" />++## Installation++<InstallBlock name="shader-swirl" />++## Usage++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { ShaderSwirl } from "@/components/remocn/shader-swirl";++const ShaderSwirlScene = () => (+ <ShaderSwirl speed={1} bandCount={4} twist={0.1} />+);++export const RemotionRoot = () => (+ <Composition+ id="ShaderSwirl"+ component={ShaderSwirlScene}+ 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 663cc570..72ad6213 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 { ShaderSwirl } from "@/registry/remocn/shader-swirl";+import { shaderSwirlConfig } from "@/registry/remocn/shader-swirl/config";import { ShaderWarp } from "@/registry/remocn/shader-warp";import { shaderWarpConfig } from "@/registry/remocn/shader-warp/config";import { NumberWheel } from "@/registry/remocn/number-wheel";@@ -326,6 +328,10 @@ const registry: Record<string, RegistryEntry> = {Component: ShaderWarp,config: shaderWarpConfig,},+ "shader-swirl": {+ Component: ShaderSwirl,+ config: shaderSwirlConfig,+ },"dynamic-grid": { Component: DynamicGrid, config: dynamicGridConfig },"simulated-cursor": {Component: SimulatedCursor,diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex ea324d5c..9fc9cdaa 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -535,6 +535,22 @@}]},+ {+ "name": "shader-swirl",+ "type": "registry:component",+ "title": "Shader Swirl",+ "description": "Concentric bands swirling around a center point.",+ "dependencies": [+ "@paper-design/shaders-react"+ ],+ "files": [+ {+ "path": "shader-swirl/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/shader-swirl.tsx"+ }+ ]+ },{"name": "dynamic-grid","type": "registry:component",diff --git a/registry/remocn/shader-swirl/config.ts b/registry/remocn/shader-swirl/config.tsnew file mode 100644index 00000000..5685531e--- /dev/null+++ b/registry/remocn/shader-swirl/config.ts@@ -0,0 +1,45 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const shaderSwirlConfig: ComponentConfig = {+ componentName: "ShaderSwirl",+ importPath: "@/components/remocn/shader-swirl",+ controls: {+ speed: {+ type: "number",+ default: 1,+ min: 0.1,+ max: 4,+ step: 0.1,+ label: "Speed",+ },+ bandCount: {+ type: "number",+ default: 4,+ min: 1,+ max: 12,+ step: 1,+ label: "Bands",+ },+ twist: {+ type: "number",+ default: 0.1,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Twist",+ },+ softness: {+ type: "number",+ default: 0.2,+ min: 0,+ max: 1,+ step: 0.05,+ label: "Softness",+ },+ colorBack: { type: "color", default: "#12121a", label: "Background" },+ },+ durationInFrames: 150,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+};diff --git a/registry/remocn/shader-swirl/index.tsx b/registry/remocn/shader-swirl/index.tsxnew file mode 100644index 00000000..a84c6348--- /dev/null+++ b/registry/remocn/shader-swirl/index.tsx@@ -0,0 +1,59 @@+"use client";++import { Swirl, type SwirlProps } from "@paper-design/shaders-react";+import { useCallback, useState } from "react";+import {+ continueRender,+ delayRender,+ useCurrentFrame,+ useVideoConfig,+} from "remotion";++const NEUTRAL_COLORS = ["#52527a", "#3a3a5c", "#232338"];++export interface ShaderSwirlProps extends Omit<SwirlProps, "frame" | "ref"> {}++export function ShaderSwirl({+ speed = 1,+ colors = NEUTRAL_COLORS,+ colorBack = "#12121a",+ bandCount = 4,+ twist = 0.1,+ softness = 0.2,+ className,+ ...rest+}: ShaderSwirlProps) {+ const frame = useCurrentFrame();+ const { fps } = useVideoConfig();++ const [handle] = useState(() => delayRender("shader-swirl"));+ 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 }}+ >+ <Swirl+ speed={0}+ frame={(frame / fps) * speed * 1000}+ colors={colors}+ colorBack={colorBack}+ bandCount={bandCount}+ twist={twist}+ softness={softness}+ style={{ width: "100%", height: "100%" }}+ {...rest}+ />+ </div>+ );+}