Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: shader spiral

dev_wandryf1ed2630147d
diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdx
index 38a2a057..7f69efb1 100644
--- a/content/docs/shaders/index.mdx
+++ b/content/docs/shaders/index.mdx
@@ -48,5 +48,11 @@ Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apac
status: "stable",
href: "/docs/shaders/shader-water",
},
+ {
+ name: "ShaderSpiral",
+ description: "Rotating spiral arms radiating from the center",
+ status: "stable",
+ href: "/docs/shaders/shader-spiral",
+ },
]}
/>
diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.json
index 8ad2fe38..cc656531 100644
--- a/content/docs/shaders/meta.json
+++ b/content/docs/shaders/meta.json
@@ -7,6 +7,7 @@
"shader-grain-gradient",
"shader-warp",
"shader-swirl",
- "shader-water"
+ "shader-water",
+ "shader-spiral"
]
}
diff --git a/content/docs/shaders/shader-spiral.mdx b/content/docs/shaders/shader-spiral.mdx
new file mode 100644
index 00000000..8b25cecb
--- /dev/null
+++ b/content/docs/shaders/shader-spiral.mdx
@@ -0,0 +1,37 @@
+---
+title: Shader Spiral
+description: Rotating spiral arms radiating from the center
+---
+
+<ComponentPreview name="shader-spiral" />
+
+## Installation
+
+<InstallBlock name="shader-spiral" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition } from "remotion";
+import { ShaderSpiral } from "@/components/remocn/shader-spiral";
+
+const ShaderSpiralScene = () => (
+ <ShaderSpiral speed={1} density={1} strokeWidth={0.5} />
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="ShaderSpiral"
+ component={ShaderSpiralScene}
+ 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__.tsx
index 11b38c1f..251ef1f2 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 { ShaderSpiral } from "@/registry/remocn/shader-spiral";
+import { shaderSpiralConfig } from "@/registry/remocn/shader-spiral/config";
import { ShaderSwirl } from "@/registry/remocn/shader-swirl";
import { shaderSwirlConfig } from "@/registry/remocn/shader-swirl/config";
import { ShaderWater } from "@/registry/remocn/shader-water";
@@ -338,6 +340,10 @@ const registry: Record<string, RegistryEntry> = {
Component: ShaderWater,
config: shaderWaterConfig,
},
+ "shader-spiral": {
+ Component: ShaderSpiral,
+ config: shaderSpiralConfig,
+ },
"dynamic-grid": { Component: DynamicGrid, config: dynamicGridConfig },
"simulated-cursor": {
Component: SimulatedCursor,
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 58a758ad..d884505a 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -567,6 +567,22 @@
}
]
},
+ {
+ "name": "shader-spiral",
+ "type": "registry:component",
+ "title": "Shader Spiral",
+ "description": "Rotating spiral arms radiating from the center.",
+ "dependencies": [
+ "@paper-design/shaders-react"
+ ],
+ "files": [
+ {
+ "path": "shader-spiral/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-spiral.tsx"
+ }
+ ]
+ },
{
"name": "dynamic-grid",
"type": "registry:component",
diff --git a/registry/remocn/shader-spiral/config.ts b/registry/remocn/shader-spiral/config.ts
new file mode 100644
index 00000000..fbb2e3b8
--- /dev/null
+++ b/registry/remocn/shader-spiral/config.ts
@@ -0,0 +1,45 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderSpiralConfig: ComponentConfig = {
+ componentName: "ShaderSpiral",
+ importPath: "@/components/remocn/shader-spiral",
+ controls: {
+ speed: {
+ type: "number",
+ default: 1,
+ min: 0.1,
+ max: 4,
+ step: 0.1,
+ label: "Speed",
+ },
+ density: {
+ type: "number",
+ default: 1,
+ min: 0.2,
+ max: 4,
+ step: 0.1,
+ label: "Density",
+ },
+ strokeWidth: {
+ type: "number",
+ default: 0.5,
+ min: 0.05,
+ max: 1,
+ step: 0.05,
+ label: "Stroke",
+ },
+ 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-spiral/index.tsx b/registry/remocn/shader-spiral/index.tsx
new file mode 100644
index 00000000..f0cc69fa
--- /dev/null
+++ b/registry/remocn/shader-spiral/index.tsx
@@ -0,0 +1,57 @@
+"use client";
+
+import { Spiral, type SpiralProps } from "@paper-design/shaders-react";
+import { useCallback, useState } from "react";
+import {
+ continueRender,
+ delayRender,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+
+export interface ShaderSpiralProps extends Omit<SpiralProps, "frame" | "ref"> {}
+
+export function ShaderSpiral({
+ speed = 1,
+ colorBack = "#12121a",
+ colorFront = "#52527a",
+ density = 1,
+ strokeWidth = 0.5,
+ softness = 0.2,
+ className,
+ ...rest
+}: ShaderSpiralProps) {
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
+
+ const [handle] = useState(() => delayRender("shader-spiral"));
+ 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 }}
+ >
+ <Spiral
+ speed={0}
+ frame={(frame / fps) * speed * 1000}
+ colorBack={colorBack}
+ colorFront={colorFront}
+ density={density}
+ strokeWidth={strokeWidth}
+ softness={softness}
+ style={{ width: "100%", height: "100%" }}
+ {...rest}
+ />
+ </div>
+ );
+}