{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "animated-bar-chart", "title": "Animated Bar Chart", "description": "Bars spring up from the baseline in a staggered cascade.", "dependencies": [ "remotion" ], "files": [ { "path": "registry/remocn/animated-bar-chart/index.tsx", "content": "\"use client\";\n\nimport { spring, useCurrentFrame, useVideoConfig } from \"remotion\";\n\nexport interface AnimatedBarChartProps {\n data?: number[];\n labels?: string[];\n width?: number;\n height?: number;\n barColor?: string;\n background?: string;\n gap?: number;\n staggerFrames?: number;\n speed?: number;\n className?: string;\n}\n\nexport function AnimatedBarChart({\n data = [35, 60, 45, 80, 55, 70, 90, 65],\n labels,\n width = 1000,\n height = 500,\n barColor = \"#0ea5e9\",\n background = \"#0a0a0a\",\n gap = 16,\n staggerFrames = 6,\n speed = 1,\n className,\n}: AnimatedBarChartProps) {\n const frame = useCurrentFrame() * speed;\n const { fps } = useVideoConfig();\n\n const padding = 60;\n const labelSpace = labels ? 40 : 0;\n const innerWidth = width - padding * 2;\n const innerHeight = height - padding * 2 - labelSpace;\n const max = Math.max(...data);\n const barWidth = (innerWidth - gap * (data.length - 1)) / data.length;\n const baseY = padding + innerHeight;\n\n return (\n \n \n {/* Baseline */}\n \n\n {data.map((value, index) => {\n const targetHeight = (value / max) * innerHeight;\n const x = padding + index * (barWidth + gap);\n const y = baseY - targetHeight;\n\n const scaleY = spring({\n frame: frame - index * staggerFrames,\n fps,\n config: { damping: 12, stiffness: 100, mass: 0.8 },\n from: 0,\n to: 1,\n });\n\n return (\n \n \n {labels && labels[index] && (\n \n {labels[index]}\n \n )}\n \n );\n })}\n \n \n );\n}\n", "type": "registry:component", "target": "components/remocn/animated-bar-chart.tsx" } ], "type": "registry:component" }