Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
"use client";
import { Easing, interpolate, spring, useVideoConfig } from "remotion";
import {
drawnPathProps,
type IconAnimationProps,
useIconAnimation,
} from "@/lib/remocn-icons";
const GEAR_PATH =
"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915";
const CIRCLE_PATH =
"M12 9 A3 3 0 0 1 15 12 A3 3 0 0 1 12 15 A3 3 0 0 1 9 12 A3 3 0 0 1 12 9";
const TIMINGS = {
drawDurationInFrames: 16,
actionDelayInFrames: 2,
actionDurationInFrames: 26,
loop: false,
} as const;
export function SettingsIcon({
animation = "both",
loop,
speed,
size = 48,
color = "currentColor",
strokeWidth = 2,
className,
}: IconAnimationProps) {
const { drawProgress, scaleIn, actionFrame } = useIconAnimation(
{ animation, loop, speed },
TIMINGS,
);
const { fps } = useVideoConfig();
const linearDraw = 1 - (1 - drawProgress) ** (1 / 3);
const gearProgress = interpolate(linearDraw, [0, 1], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: Easing.inOut(Easing.quad),
});
const circleProgress = interpolate(linearDraw, [0.625, 1], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: Easing.out(Easing.quad),
});
const gear = drawnPathProps(GEAR_PATH, gearProgress);
const circle = drawnPathProps(CIRCLE_PATH, circleProgress);
const gearRotate =
60 *
spring({
frame: actionFrame,
fps,
config: { damping: 14, stiffness: 120, mass: 0.9 },
durationInFrames: 26,
});
const scale = 0.85 + 0.15 * scaleIn;
return (
<svg
className={className}
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke={color}
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
style={{
overflow: "visible",
transformOrigin: "center",
transform: `scale(${scale})`,
}}
>
<g transform={`rotate(${gearRotate} 12 12)`}>
<path
d={GEAR_PATH}
strokeDasharray={gear.strokeDasharray}
strokeDashoffset={gear.strokeDashoffset}
/>
</g>
<path
d={CIRCLE_PATH}
strokeDasharray={circle.strokeDasharray}
strokeDashoffset={circle.strokeDashoffset}
/>
</svg>
);
}
export function SettingsIconStatic({
size = 48,
color = "currentColor",
strokeWidth = 2,
className,
}: {
size?: number;
color?: string;
strokeWidth?: number;
className?: string;
}) {
return (
<svg
className={className}
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke={color}
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d={GEAR_PATH} />
<circle cx="12" cy="12" r="3" />
</svg>
);
}