Skip to content

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

feat: shader metal

dev_wandrya980fbd6d4d2
diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdx
index 7f69efb1..ce539358 100644
--- a/content/docs/shaders/index.mdx
+++ b/content/docs/shaders/index.mdx
@@ -54,5 +54,11 @@ Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apac
status: "stable",
href: "/docs/shaders/shader-spiral",
},
+ {
+ name: "ShaderLiquidMetal",
+ description: "Molten metallic surface with flowing specular highlights",
+ status: "stable",
+ href: "/docs/shaders/shader-liquid-metal",
+ },
]}
/>
diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.json
index cc656531..5c9bfb8e 100644
--- a/content/docs/shaders/meta.json
+++ b/content/docs/shaders/meta.json
@@ -8,6 +8,7 @@
"shader-warp",
"shader-swirl",
"shader-water",
- "shader-spiral"
+ "shader-spiral",
+ "shader-liquid-metal"
]
}
diff --git a/content/docs/shaders/shader-liquid-metal.mdx b/content/docs/shaders/shader-liquid-metal.mdx
new file mode 100644
index 00000000..1c029150
--- /dev/null
+++ b/content/docs/shaders/shader-liquid-metal.mdx
@@ -0,0 +1,37 @@
+---
+title: Shader Liquid Metal
+description: Molten metallic surface with flowing specular highlights
+---
+
+<ComponentPreview name="shader-liquid-metal" />
+
+## Installation
+
+<InstallBlock name="shader-liquid-metal" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition } from "remotion";
+import { ShaderLiquidMetal } from "@/components/remocn/shader-liquid-metal";
+
+const ShaderLiquidMetalScene = () => (
+ <ShaderLiquidMetal speed={1} distortion={0.07} repetition={2} />
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="ShaderLiquidMetal"
+ component={ShaderLiquidMetalScene}
+ 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 251ef1f2..7b42f76c 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -83,6 +83,8 @@ import { MeshGradientBg } from "@/registry/remocn/mesh-gradient-bg";
import { meshGradientBgConfig } from "@/registry/remocn/mesh-gradient-bg/config";
import { ShaderGrainGradient } from "@/registry/remocn/shader-grain-gradient";
import { shaderGrainGradientConfig } from "@/registry/remocn/shader-grain-gradient/config";
+import { ShaderLiquidMetal } from "@/registry/remocn/shader-liquid-metal";
+import { shaderLiquidMetalConfig } from "@/registry/remocn/shader-liquid-metal/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";
@@ -344,6 +346,10 @@ const registry: Record<string, RegistryEntry> = {
Component: ShaderSpiral,
config: shaderSpiralConfig,
},
+ "shader-liquid-metal": {
+ Component: ShaderLiquidMetal,
+ config: shaderLiquidMetalConfig,
+ },
"dynamic-grid": { Component: DynamicGrid, config: dynamicGridConfig },
"simulated-cursor": {
Component: SimulatedCursor,
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index d884505a..4f423dd6 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -583,6 +583,22 @@
}
]
},
+ {
+ "name": "shader-liquid-metal",
+ "type": "registry:component",
+ "title": "Shader Liquid Metal",
+ "description": "Molten metallic surface with flowing specular highlights.",
+ "dependencies": [
+ "@paper-design/shaders-react"
+ ],
+ "files": [
+ {
+ "path": "shader-liquid-metal/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-liquid-metal.tsx"
+ }
+ ]
+ },
{
"name": "dynamic-grid",
"type": "registry:component",
diff --git a/registry/remocn/shader-grain-gradient/index.tsx b/registry/remocn/shader-grain-gradient/index.tsx
index 9ed7865d..eb12d3c9 100644
--- a/registry/remocn/shader-grain-gradient/index.tsx
+++ b/registry/remocn/shader-grain-gradient/index.tsx
@@ -28,7 +28,7 @@ export function ShaderGrainGradient({
...rest
}: ShaderGrainGradientProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-grain-gradient"));
const gate = useCallback(
@@ -55,7 +55,9 @@ export function ShaderGrainGradient({
softness={softness}
intensity={intensity}
noise={noise}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>
diff --git a/registry/remocn/shader-liquid-metal/config.ts b/registry/remocn/shader-liquid-metal/config.ts
new file mode 100644
index 00000000..aa4259ef
--- /dev/null
+++ b/registry/remocn/shader-liquid-metal/config.ts
@@ -0,0 +1,46 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderLiquidMetalConfig: ComponentConfig = {
+ componentName: "ShaderLiquidMetal",
+ importPath: "@/components/remocn/shader-liquid-metal",
+ controls: {
+ speed: {
+ type: "number",
+ default: 1,
+ min: 0.1,
+ max: 4,
+ step: 0.1,
+ label: "Speed",
+ },
+ distortion: {
+ type: "number",
+ default: 0.1,
+ min: 0,
+ max: 0.5,
+ step: 0.01,
+ label: "Distortion",
+ },
+ repetition: {
+ type: "number",
+ default: 1.5,
+ min: 1,
+ max: 6,
+ step: 0.5,
+ label: "Repetition",
+ },
+ contour: {
+ type: "number",
+ default: 0.4,
+ min: 0,
+ max: 1,
+ step: 0.05,
+ label: "Contour",
+ },
+ colorBack: { type: "color", default: "#2a2a30", label: "Background" },
+ colorTint: { type: "color", default: "#8a8a95", label: "Tint" },
+ },
+ durationInFrames: 150,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/shader-liquid-metal/index.tsx b/registry/remocn/shader-liquid-metal/index.tsx
new file mode 100644
index 00000000..b6b02dfc
--- /dev/null
+++ b/registry/remocn/shader-liquid-metal/index.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import {
+ LiquidMetal,
+ type LiquidMetalProps,
+} from "@paper-design/shaders-react";
+import { useCallback, useState } from "react";
+import {
+ continueRender,
+ delayRender,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+
+export interface ShaderLiquidMetalProps
+ extends Omit<LiquidMetalProps, "frame" | "ref"> {}
+
+export function ShaderLiquidMetal({
+ speed = 1,
+ colorBack = "#2a2a30",
+ colorTint = "#8a8a95",
+ distortion = 0.1,
+ repetition = 1.5,
+ contour = 0.4,
+ softness = 0.05,
+ shape = "none",
+ className,
+ ...rest
+}: ShaderLiquidMetalProps) {
+ const frame = useCurrentFrame();
+ const { fps, width, height } = useVideoConfig();
+
+ const [handle] = useState(() => delayRender("shader-liquid-metal"));
+ 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 }}
+ >
+ <LiquidMetal
+ speed={0}
+ frame={(frame / fps) * speed * 1000}
+ colorBack={colorBack}
+ colorTint={colorTint}
+ distortion={distortion}
+ repetition={repetition}
+ contour={contour}
+ softness={softness}
+ shape={shape}
+ fit="cover"
+ width={width}
+ height={height}
+ {...rest}
+ />
+ </div>
+ );
+}
diff --git a/registry/remocn/shader-mesh-gradient/index.tsx b/registry/remocn/shader-mesh-gradient/index.tsx
index 4b4405de..22d69caf 100644
--- a/registry/remocn/shader-mesh-gradient/index.tsx
+++ b/registry/remocn/shader-mesh-gradient/index.tsx
@@ -26,7 +26,7 @@ export function ShaderMeshGradient({
...rest
}: ShaderMeshGradientProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-mesh-gradient"));
const gate = useCallback(
@@ -51,7 +51,9 @@ export function ShaderMeshGradient({
colors={colors}
distortion={distortion}
swirl={swirl}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>
diff --git a/registry/remocn/shader-spiral/index.tsx b/registry/remocn/shader-spiral/index.tsx
index f0cc69fa..7c9beb3b 100644
--- a/registry/remocn/shader-spiral/index.tsx
+++ b/registry/remocn/shader-spiral/index.tsx
@@ -22,7 +22,7 @@ export function ShaderSpiral({
...rest
}: ShaderSpiralProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-spiral"));
const gate = useCallback(
@@ -49,7 +49,9 @@ export function ShaderSpiral({
density={density}
strokeWidth={strokeWidth}
softness={softness}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>
diff --git a/registry/remocn/shader-swirl/index.tsx b/registry/remocn/shader-swirl/index.tsx
index a84c6348..0a4f39a5 100644
--- a/registry/remocn/shader-swirl/index.tsx
+++ b/registry/remocn/shader-swirl/index.tsx
@@ -24,7 +24,7 @@ export function ShaderSwirl({
...rest
}: ShaderSwirlProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-swirl"));
const gate = useCallback(
@@ -51,7 +51,9 @@ export function ShaderSwirl({
bandCount={bandCount}
twist={twist}
softness={softness}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>
diff --git a/registry/remocn/shader-warp/index.tsx b/registry/remocn/shader-warp/index.tsx
index 3b2ca44b..17237281 100644
--- a/registry/remocn/shader-warp/index.tsx
+++ b/registry/remocn/shader-warp/index.tsx
@@ -24,7 +24,7 @@ export function ShaderWarp({
...rest
}: ShaderWarpProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-warp"));
const gate = useCallback(
@@ -51,7 +51,9 @@ export function ShaderWarp({
softness={softness}
distortion={distortion}
swirl={swirl}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>
diff --git a/registry/remocn/shader-water/index.tsx b/registry/remocn/shader-water/index.tsx
index deee34c1..38553ebc 100644
--- a/registry/remocn/shader-water/index.tsx
+++ b/registry/remocn/shader-water/index.tsx
@@ -22,7 +22,7 @@ export function ShaderWater({
...rest
}: ShaderWaterProps) {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const { fps, width, height } = useVideoConfig();
const [handle] = useState(() => delayRender("shader-water"));
const gate = useCallback(
@@ -49,7 +49,9 @@ export function ShaderWater({
highlights={highlights}
waves={waves}
caustic={caustic}
- style={{ width: "100%", height: "100%" }}
+ fit="cover"
+ width={width}
+ height={height}
{...rest}
/>
</div>