Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
"use client";
import { Easing, interpolate } from "remotion";
import {
drawnPathProps,
type IconAnimationProps,
useIconAnimation,
} from "@/lib/remocn-icons";
const HEART_PATH =
"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5";
const TIMINGS = {
drawDurationInFrames: 14,
actionDelayInFrames: 2,
actionDurationInFrames: 26,
loop: false,
} as const;
export function HeartIcon({
animation = "both",
loop,
speed,
size = 48,
color = "currentColor",
strokeWidth = 2,
className,
}: IconAnimationProps) {
const { drawProgress, scaleIn, actionProgress } = useIconAnimation(
{ animation, loop, speed },
TIMINGS,
);
const linearDraw = 1 - (1 - drawProgress) ** (1 / 3);
const heartProgress = interpolate(linearDraw, [0, 1], [0, 1], {
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: Easing.inOut(Easing.quad),
});
const heart = drawnPathProps(HEART_PATH, heartProgress);
const beat = interpolate(
actionProgress,
[0, 0.2, 0.4, 0.6, 0.8, 1],
[1, 1.16, 1, 1.1, 1, 1],
{
extrapolateLeft: "clamp",
extrapolateRight: "clamp",
easing: Easing.inOut(Easing.quad),
},
);
const scale = (0.85 + 0.15 * scaleIn) * beat;
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})`,
}}
>
<path
d={HEART_PATH}
strokeDasharray={heart.strokeDasharray}
strokeDashoffset={heart.strokeDashoffset}
/>
</svg>
);
}
export function HeartIconStatic({
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={HEART_PATH} />
</svg>
);
}