Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added followers reached components
dev_wandry8ddeb0c16c88
diff --git a/config/site.ts b/config/site.tsindex 8db58761..2e885899 100644--- a/config/site.ts+++ b/config/site.ts@@ -42,6 +42,8 @@ export const NAV_LINKS: NavLink[] = [export const NEW_BADGE_PATHS = new Set<string>(["/docs/social/github-stars","/docs/social/x-follow-card",+ "/docs/social/x-followers-overview",+ "/docs/effects/confetti",]);export const FOOTER_NAV: NavLink[] = [diff --git a/content/docs/effects/confetti.mdx b/content/docs/effects/confetti.mdxnew file mode 100644index 00000000..90a9d20d--- /dev/null+++ b/content/docs/effects/confetti.mdx@@ -0,0 +1,116 @@+---+title: Confetti+description: Deterministic confetti burst for Remotion — seeded particles with gravity, spin, and flutter+---++<ComponentPreview name="confetti" />++## Installation++<InstallBlock name="confetti" />++## Usage++Confetti is an overlay — render it on top of any scene and set `startFrame` to the frame the burst should fire:++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { Confetti } from "@/components/remocn/confetti";++const ConfettiScene = () => (+ <Confetti+ startFrame={0}+ originX={0.5}+ originY={0.5}+ particleCount={160}+ seed={1}+ />+);++export const RemotionRoot = () => (+ <Composition+ id="Confetti"+ component={ConfettiScene}+ durationInFrames={90}+ fps={30}+ width={1280}+ height={720}+ />+);+```++Every piece is generated from a seeded PRNG, so a given `seed` renders an identical burst on every machine — required for deterministic Remotion output and headless MP4 export. Particles launch radially from the origin, fall under `gravity`, and flutter as they spin.++## Props++<PropsTable+ rows={[+ {+ name: "particleCount",+ type: "number",+ default: "140",+ description: "Number of confetti pieces",+ },+ {+ name: "colors",+ type: "string[]",+ default: "6 brand colors",+ description: "Palette each piece is drawn from",+ },+ {+ name: "originX",+ type: "number",+ default: "0.5",+ description: "Burst origin X as a 0..1 fraction of the canvas",+ },+ {+ name: "originY",+ type: "number",+ default: "0.5",+ description: "Burst origin Y as a 0..1 fraction of the canvas",+ },+ {+ name: "startFrame",+ type: "number",+ default: "0",+ description: "Frame the burst fires on",+ },+ {+ name: "lifetime",+ type: "number",+ default: "90",+ description: "How long the burst lives, in frames",+ },+ {+ name: "power",+ type: "number",+ default: "17",+ description: "Initial launch speed (px/frame at the 720px reference height)",+ },+ {+ name: "gravity",+ type: "number",+ default: "0.45",+ description: "Downward acceleration (px/frame² at the 720px reference height)",+ },+ {+ name: "size",+ type: "number",+ default: "13",+ description: "Base piece size in reference px",+ },+ {+ name: "seed",+ type: "number",+ default: "1",+ description: "PRNG seed — the same seed renders an identical burst every time",+ },+ ]}+/>++## Notes++- **Deterministic:** Particles come from a `mulberry32` seeded PRNG, never `Math.random()`, so renders are frame-stable and reproducible.+- **Overlay:** The component is a transparent, `pointer-events: none` `AbsoluteFill` — layer it over any composition.+- **Used by:** `x-followers-overview` fires this on the follower-count reveal.diff --git a/content/docs/effects/index.mdx b/content/docs/effects/index.mdxnew file mode 100644index 00000000..96e48a65--- /dev/null+++ b/content/docs/effects/index.mdx@@ -0,0 +1,17 @@+---+title: Effects+description: Reusable Remotion effect overlays for celebratory and atmospheric moments+---++Drop-in effect overlays you compose on top of any scene — fire them on a frame and let them play out.++<ComponentCardGrid+ items={[+ {+ name: "Confetti",+ description: "Deterministic confetti burst — seeded particles with gravity, spin, and flutter, fired on any frame",+ status: "stable",+ href: "/docs/effects/confetti",+ },+ ]}+/>diff --git a/content/docs/effects/meta.json b/content/docs/effects/meta.jsonnew file mode 100644index 00000000..3db0aeb8--- /dev/null+++ b/content/docs/effects/meta.json@@ -0,0 +1,5 @@+{+ "title": "Effects",+ "collapsible": false,+ "pages": ["index", "confetti"]+}diff --git a/content/docs/meta.json b/content/docs/meta.jsonindex 506486bc..a014d678 100644--- a/content/docs/meta.json+++ b/content/docs/meta.json@@ -8,6 +8,7 @@"ui-blocks","transitions","social",+ "effects","compositions"]}diff --git a/content/docs/social/index.mdx b/content/docs/social/index.mdxindex 3b7f4617..944be39a 100644--- a/content/docs/social/index.mdx+++ b/content/docs/social/index.mdx@@ -19,5 +19,11 @@ Ready-to-install compositions that turn GitHub stats, product launches, and commstatus: "stable",href: "/docs/social/x-follow-card",},+ {+ name: "XFollowersOverview",+ description: "X follow notifications flip through in 3D, then the total follower count blurs in",+ status: "stable",+ href: "/docs/social/x-followers-overview",+ },]}/>diff --git a/content/docs/social/meta.json b/content/docs/social/meta.jsonindex 889537f3..ef49c96f 100644--- a/content/docs/social/meta.json+++ b/content/docs/social/meta.json@@ -1,5 +1,5 @@{"title": "Social","collapsible": false,- "pages": ["index", "github-stars", "x-follow-card"]+ "pages": ["index", "github-stars", "x-follow-card", "x-followers-overview"]}diff --git a/content/docs/social/x-followers-overview.mdx b/content/docs/social/x-followers-overview.mdxnew file mode 100644index 00000000..bebdea97--- /dev/null+++ b/content/docs/social/x-followers-overview.mdx@@ -0,0 +1,122 @@+---+title: X Followers Overview+description: X follow notifications flip through in 3D, then the total follower count blurs in+---++<ComponentPreview name="x-followers-overview" />++## Installation++<InstallBlock name="x-followers-overview" />++<Note>+ Installing `x-followers-overview` automatically pulls the `confetti` effect as a dependency via `registryDependencies`. No additional install needed.+</Note>++## Usage++Standalone in a Remotion `<Composition>` — uses a sample notification list so the video renders immediately after install:++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { XFollowersOverview } from "@/components/remocn/x-followers-overview";++const XFollowersOverviewScene = () => (+ <XFollowersOverview+ notifications={[+ { name: "Andre Vitorio", verified: true, time: "7h" },+ { name: "Sarah Chen", verified: true, time: "9h" },+ { name: "marcus", verified: false, time: "11h" },+ ]}+ totalFollowers={1709}+ handle="remocn"+ avatarUrl="/logo.svg"+ accentColor="#1d9bf0"+ theme="light"+ orientation="horizontal"+ speed={1}+ />+);++export const RemotionRoot = () => (+ <Composition+ id="XFollowersOverview"+ component={XFollowersOverviewScene}+ durationInFrames={360}+ fps={30}+ width={1280}+ height={720}+ />+);+```++Each follow notification — `<name> followed you · <time>` — is centered, and only the username flips into view on a 3D `rotateX` carousel while the rest of the line stays put. After the list is exhausted, the notifications fade and the total follower count pops in with a spring overshoot, blur, and a centered confetti burst. In sync with the count, the avatar slides in from the left and the handle from the right, just above it.++## Props++<PropsTable+ rows={[+ {+ name: "notifications",+ type: "FollowerNotification[]",+ default: "SAMPLE_FOLLOWERS",+ description: "List of follow notifications to cycle through — each is { name, verified, time }. Defaults to a hardcoded sample (swap for X API data)",+ },+ {+ name: "totalFollowers",+ type: "number",+ default: "1709",+ description: "Total follower count revealed after the notifications finish",+ },+ {+ name: "handle",+ type: "string",+ default: "\"remocn\"",+ description: "X username (without the @) shown in the reveal, blurring in from the right",+ },+ {+ name: "avatarUrl",+ type: "string",+ default: "\"/logo.svg\"",+ description: "Profile picture shown in the reveal, blurring in from the left — falls back to the handle initial",+ },+ {+ name: "accentColor",+ type: "string",+ default: "\"#1d9bf0\"",+ description: "X brand blue — used for the verified badge",+ },+ {+ name: "theme",+ type: "\"light\" | \"dark\"",+ default: "\"light\"",+ description: "Color theme for the background and text",+ },+ {+ name: "background",+ type: "\"surface\" | \"transparent\"",+ default: "\"surface\"",+ description: "Background — surface renders the theme color; transparent shows nothing behind the text",+ },+ {+ name: "orientation",+ type: "\"horizontal\" | \"vertical\"",+ default: "\"horizontal\"",+ description: "Layout orientation — horizontal is 1280×720 (16:9), vertical is 720×1280 (9:16) letterboxed",+ },+ {+ name: "speed",+ type: "number",+ default: "1",+ description: "Animation speed multiplier — minimum 1 so the timeline always reaches the reveal",+ },+ ]}+/>++## Notes++- **Offline rendering:** The notification list is plain data and the composition makes no network requests, so the preview works offline and MP4 export needs no CORS setup.+- **3D flip:** Only the username flips on a `rotateX` carousel under CSS `perspective`; the line is centered via an invisible spacer sized to the active name, so it never drifts as names swap.+- **Reveal:** The total count uses Manrope with `tabular-nums` and pops in with a spring overshoot + blur, accompanied by a `confetti` burst.+- **X API ready:** `notifications` defaults to `SAMPLE_FOLLOWERS`; pass live follower data in the same `{ name, verified, time }` shape to drive it from the X API.diff --git a/registry/__index__.tsx b/registry/__index__.tsxindex 96c9ff9f..39008208 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -97,6 +97,10 @@ import { Typewriter } from "@/registry/remocn/typewriter";import { typewriterConfig } from "@/registry/remocn/typewriter/config";import { XFollowCard } from "@/registry/remocn/x-follow-card";import { xFollowCardConfig } from "@/registry/remocn/x-follow-card/config";+import { XFollowersOverview } from "@/registry/remocn/x-followers-overview";+import { xFollowersOverviewConfig } from "@/registry/remocn/x-followers-overview/config";+import { Confetti } from "@/registry/remocn/confetti";+import { confettiConfig } from "@/registry/remocn/confetti/config";import { Accordion } from "@/registry/remocn-ui/accordion";import { accordionConfig } from "@/registry/remocn-ui/accordion/config";import { AlertDialog } from "@/registry/remocn-ui/alert-dialog";@@ -318,6 +322,11 @@ const registry: Record<string, RegistryEntry> = {},"github-stars": { Component: GitHubStars, config: githubStarsConfig },"x-follow-card": { Component: XFollowCard, config: xFollowCardConfig },+ "x-followers-overview": {+ Component: XFollowersOverview,+ config: xFollowersOverviewConfig,+ },+ "confetti": { Component: Confetti, config: confettiConfig },"button": { Component: Button, config: buttonConfig },"accordion": { Component: Accordion, config: accordionConfig },"alert-dialog": { Component: AlertDialog, config: alertDialogConfig },@@ -427,4 +436,19 @@ if (xFollowCard) {};}+// x-followers-overview cycles notifications then blur-reveals the total at a+// fixed point in the timeline. A speed < 1 would stall the driver before the+// reveal frame, so cap min:1 like github-stars.+const xFollowersOverview = registry["x-followers-overview"];+if (xFollowersOverview) {+ xFollowersOverview.config.controls.speed = {+ type: "number",+ default: 1,+ min: 1,+ max: 4,+ step: 0.25,+ label: "Speed",+ };+}+export default registry;diff --git a/registry/remocn/confetti/__tests__/confetti.test.ts b/registry/remocn/confetti/__tests__/confetti.test.tsnew file mode 100644index 00000000..3aa94218--- /dev/null+++ b/registry/remocn/confetti/__tests__/confetti.test.ts@@ -0,0 +1,87 @@+/**+ * Unit tests for pure helpers in registry/remocn/confetti/index.tsx.+ *+ * Run with:+ * bun add -d vitest+ * bunx vitest run registry/remocn/confetti/__tests__/confetti.test.ts+ *+ * No React DOM or Remotion player needed — only pure JS logic is exercised.+ */++import { describe, expect, it } from "vitest";++import { makeParticles, mulberry32, particleOpacity } from "../index";++describe("mulberry32", () => {+ it("is deterministic for a given seed", () => {+ const a = mulberry32(42);+ const b = mulberry32(42);+ const seqA = [a(), a(), a()];+ const seqB = [b(), b(), b()];+ expect(seqA).toEqual(seqB);+ });++ it("yields values in [0, 1)", () => {+ const r = mulberry32(7);+ for (let i = 0; i < 50; i++) {+ const v = r();+ expect(v).toBeGreaterThanOrEqual(0);+ expect(v).toBeLessThan(1);+ }+ });++ it("differs across seeds", () => {+ expect(mulberry32(1)()).not.toEqual(mulberry32(2)());+ });+});++describe("makeParticles", () => {+ const colors = ["#111", "#222", "#333"];++ it("produces exactly `count` particles", () => {+ expect(makeParticles({ count: 0, seed: 1, colors })).toHaveLength(0);+ expect(makeParticles({ count: 25, seed: 1, colors })).toHaveLength(25);+ });++ it("is deterministic for a seed and only uses palette colors", () => {+ const a = makeParticles({ count: 30, seed: 9, colors });+ const b = makeParticles({ count: 30, seed: 9, colors });+ expect(a).toEqual(b);+ for (const p of a) {+ expect(colors).toContain(p.color);+ expect(p.angle).toBeGreaterThanOrEqual(0);+ expect(p.angle).toBeLessThanOrEqual(Math.PI * 2);+ expect(p.size).toBeGreaterThan(0);+ }+ });++ it("changes with the seed", () => {+ const a = makeParticles({ count: 10, seed: 1, colors });+ const b = makeParticles({ count: 10, seed: 2, colors });+ expect(a).not.toEqual(b);+ });++ it("falls back to default colors when none supplied", () => {+ const p = makeParticles({ count: 5, seed: 1, colors: [] });+ expect(p).toHaveLength(5);+ for (const piece of p) {+ expect(typeof piece.color).toBe("string");+ expect(piece.color.length).toBeGreaterThan(0);+ }+ });+});++describe("particleOpacity", () => {+ it("is 0 outside the lifetime window", () => {+ expect(particleOpacity(-1, 90)).toBe(0);+ expect(particleOpacity(91, 90)).toBe(0);+ });++ it("fades in quickly and out toward the end", () => {+ expect(particleOpacity(0, 90)).toBe(0);+ expect(particleOpacity(4, 90)).toBeCloseTo(1, 6);+ expect(particleOpacity(45, 90)).toBeCloseTo(1, 6);+ expect(particleOpacity(90, 90)).toBeCloseTo(0, 6);+ expect(particleOpacity(81, 90)).toBeLessThan(1);+ });+});diff --git a/registry/remocn/confetti/config.ts b/registry/remocn/confetti/config.tsnew file mode 100644index 00000000..9f35fea1--- /dev/null+++ b/registry/remocn/confetti/config.ts@@ -0,0 +1,52 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const confettiConfig: ComponentConfig = {+ componentName: "Confetti",+ importPath: "@/components/remocn/confetti",+ controls: {+ particleCount: {+ type: "number",+ default: 140,+ min: 10,+ max: 400,+ step: 10,+ label: "Particles",+ },+ power: {+ type: "number",+ default: 17,+ min: 4,+ max: 40,+ step: 1,+ label: "Power",+ },+ gravity: {+ type: "number",+ default: 0.45,+ min: 0,+ max: 1.5,+ step: 0.05,+ label: "Gravity",+ },+ size: {+ type: "number",+ default: 13,+ min: 4,+ max: 30,+ step: 1,+ label: "Size",+ },+ seed: {+ type: "number",+ default: 1,+ min: 1,+ max: 9999,+ step: 1,+ label: "Seed",+ },+ },+ durationInFrames: 90,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+};diff --git a/registry/remocn/confetti/index.tsx b/registry/remocn/confetti/index.tsxnew file mode 100644index 00000000..fc88d05b--- /dev/null+++ b/registry/remocn/confetti/index.tsx@@ -0,0 +1,159 @@+"use client";++import { AbsoluteFill, interpolate, useCurrentFrame, useVideoConfig } from "remotion";++export interface ConfettiProps {+ /** Number of confetti pieces. */+ particleCount?: number;+ colors?: string[];+ /** Burst origin as a 0..1 fraction of the canvas. */+ originX?: number;+ originY?: number;+ /** Frame the burst fires on. */+ startFrame?: number;+ /** Lifetime of the burst, in frames. */+ lifetime?: number;+ /** Initial launch speed (px/frame at the 720px reference height). */+ power?: number;+ /** Downward acceleration (px/frame² at the 720px reference height). */+ gravity?: number;+ /** Base piece size in reference px. */+ size?: number;+ /** PRNG seed — same seed renders an identical burst every time. */+ seed?: number;+}++export interface Particle {+ angle: number;+ speed: number;+ color: string;+ size: number;+ rot0: number;+ spin: number;+ drift: number;+}++const DEFAULT_COLORS = [+ "#1d9bf0",+ "#ff5da2",+ "#ffd23f",+ "#22c55e",+ "#a855f7",+ "#ff7a45",+];++// --- Pure helpers (unit-tested) -------------------------------------------++/** Deterministic PRNG (mulberry32) — returns a function yielding [0, 1). */+export function mulberry32(seed: number): () => number {+ let a = seed >>> 0;+ return () => {+ a = (a + 0x6d2b79f5) | 0;+ let t = Math.imul(a ^ (a >>> 15), 1 | a);+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;+ };+}++/** Build a deterministic particle set for a seed (stable across renders). */+export function makeParticles({+ count,+ seed,+ colors,+}: {+ count: number;+ seed: number;+ colors: string[];+}): Particle[] {+ const rand = mulberry32(seed);+ const palette = colors.length > 0 ? colors : DEFAULT_COLORS;+ const out: Particle[] = [];+ for (let i = 0; i < count; i++) {+ const angle = rand() * Math.PI * 2;+ const speed = 0.35 + 0.65 * rand();+ out.push({+ angle,+ speed,+ color: palette[Math.floor(rand() * palette.length)],+ size: 0.7 + 0.6 * rand(),+ rot0: rand() * Math.PI * 2,+ spin: (rand() - 0.5) * 0.6,+ drift: (rand() - 0.5) * 2,+ });+ }+ return out;+}++/** Opacity envelope over a particle's lifetime: quick fade-in, slow fade-out. */+export function particleOpacity(tt: number, lifetime: number): number {+ if (tt < 0 || tt > lifetime) return 0;+ const fadeIn = interpolate(tt, [0, 4], [0, 1], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ });+ const fadeOut = interpolate(tt, [lifetime * 0.7, lifetime], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ });+ return Math.min(fadeIn, fadeOut);+}++// --- Component -------------------------------------------------------------++export function Confetti({+ particleCount = 140,+ colors = DEFAULT_COLORS,+ originX = 0.5,+ originY = 0.5,+ startFrame = 0,+ lifetime = 90,+ power = 17,+ gravity = 0.45,+ size = 13,+ seed = 1,+}: ConfettiProps) {+ const frame = useCurrentFrame();+ const { width, height } = useVideoConfig();++ const tt = frame - startFrame;+ if (tt < 0 || tt > lifetime) return null;++ const sc = height / 720;+ const ox = width * originX;+ const oy = height * originY;+ const particles = makeParticles({ count: particleCount, seed, colors });++ return (+ <AbsoluteFill style={{ pointerEvents: "none" }}>+ {particles.map((p, i) => {+ const opacity = particleOpacity(tt, lifetime);+ if (opacity <= 0) return null;++ const vx = Math.cos(p.angle) * p.speed * power + p.drift;+ const vy = Math.sin(p.angle) * p.speed * power;+ const x = ox + vx * tt * sc;+ const y = oy + (vy * tt + 0.5 * gravity * tt * tt) * sc;+ const rot = p.rot0 + p.spin * tt;+ const flutter = Math.cos(p.rot0 + p.spin * tt * 1.6);+ const w = size * p.size * sc;++ return (+ <div+ key={i}+ style={{+ position: "absolute",+ left: x,+ top: y,+ width: w,+ height: w * 0.62,+ borderRadius: 2,+ background: p.color,+ opacity,+ transform: `translate(-50%, -50%) rotate(${rot}rad) scaleX(${flutter})`,+ }}+ />+ );+ })}+ </AbsoluteFill>+ );+}diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex 93ec1177..a881a0ed 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -689,6 +689,35 @@"target": "components/remocn/x-follow-card.tsx"}]+ },+ {+ "name": "x-followers-overview",+ "type": "registry:component",+ "title": "X Followers Overview",+ "description": "X follow notifications cycle through as 3D flipping text — '<name> followed you · 7h' — then the total follower count pops in with a confetti burst. Hardcoded sample list (X API ready). Light/dark, horizontal or vertical.",+ "dependencies": ["remotion", "@remotion/google-fonts"],+ "registryDependencies": ["@remocn/confetti"],+ "files": [+ {+ "path": "x-followers-overview/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/x-followers-overview.tsx"+ }+ ]+ },+ {+ "name": "confetti",+ "type": "registry:component",+ "title": "Confetti",+ "description": "Deterministic confetti burst for Remotion — seeded particles with gravity, spin, and flutter so every render is identical. Fire it on any frame as a celebratory overlay.",+ "dependencies": ["remotion"],+ "files": [+ {+ "path": "confetti/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/confetti.tsx"+ }+ ]}]}diff --git a/registry/remocn/x-followers-overview/__tests__/x-followers-overview.test.ts b/registry/remocn/x-followers-overview/__tests__/x-followers-overview.test.tsnew file mode 100644index 00000000..d43cf303--- /dev/null+++ b/registry/remocn/x-followers-overview/__tests__/x-followers-overview.test.ts@@ -0,0 +1,75 @@+/**+ * Unit tests for pure helpers in registry/remocn/x-followers-overview/index.tsx.+ *+ * Run with:+ * bun add -d vitest+ * bunx vitest run registry/remocn/x-followers-overview/__tests__/x-followers-overview.test.ts+ *+ * No React DOM or Remotion player needed — only pure JS logic is exercised.+ * All tests are fully deterministic (no network, no Date.now).+ */++import { describe, expect, it } from "vitest";++import { blurIn, flipEase, slotProgress } from "../index";++describe("slotProgress", () => {+ it("advances index one per slot and tracks the in-slot fraction", () => {+ expect(slotProgress(0, 30, 5)).toEqual({ idx: 0, frac: 0 });+ expect(slotProgress(15, 30, 5)).toEqual({ idx: 0, frac: 0.5 });+ expect(slotProgress(30, 30, 5)).toEqual({ idx: 1, frac: 0 });+ expect(slotProgress(75, 30, 5)).toEqual({ idx: 2, frac: 0.5 });+ });++ it("clamps the index to the last item past the end", () => {+ expect(slotProgress(1000, 30, 5)).toEqual({ idx: 4, frac: 1 });+ });++ it("is safe for degenerate inputs", () => {+ expect(slotProgress(10, 0, 5)).toEqual({ idx: 0, frac: 0 });+ expect(slotProgress(10, 30, 0)).toEqual({ idx: 0, frac: 0 });+ });+});++describe("flipEase", () => {+ it("holds at 0 through the hold window, then ramps to 1", () => {+ expect(flipEase(0, 0.58)).toBe(0);+ expect(flipEase(0.58, 0.58)).toBe(0);+ expect(flipEase(1, 0.58)).toBeCloseTo(1, 6);+ });++ it("is monotonically non-decreasing", () => {+ let prev = -1;+ for (let f = 0; f <= 1.0001; f += 0.05) {+ const v = flipEase(f, 0.58);+ expect(v).toBeGreaterThanOrEqual(prev);+ prev = v;+ }+ });++ it("returns 0 when there is no room to ramp", () => {+ expect(flipEase(0.5, 1)).toBe(0);+ });+});++describe("blurIn", () => {+ it("is hidden+blurred before start and fully resolved after end", () => {+ const before = blurIn(0, 6, 24);+ expect(before.opacity).toBe(0);+ expect(before.blur).toBe(10);+ expect(before.translateY).toBe(12);++ const after = blurIn(100, 6, 24);+ expect(after.opacity).toBe(1);+ expect(after.blur).toBe(0);+ expect(after.translateY).toBe(0);+ });++ it("interpolates monotonically across the window", () => {+ const mid = blurIn(15, 6, 24);+ expect(mid.opacity).toBeGreaterThan(0);+ expect(mid.opacity).toBeLessThan(1);+ expect(mid.blur).toBeGreaterThan(0);+ expect(mid.blur).toBeLessThan(10);+ });+});diff --git a/registry/remocn/x-followers-overview/config.ts b/registry/remocn/x-followers-overview/config.tsnew file mode 100644index 00000000..175b6322--- /dev/null+++ b/registry/remocn/x-followers-overview/config.ts@@ -0,0 +1,43 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const xFollowersOverviewConfig: ComponentConfig = {+ componentName: "XFollowersOverview",+ importPath: "@/components/remocn/x-followers-overview",+ controls: {+ totalFollowers: {+ type: "number",+ default: 1709,+ min: 0,+ max: 10000000,+ step: 1,+ label: "Total followers",+ },+ handle: { type: "text", default: "remocn", label: "Handle" },+ avatarUrl: { type: "text", default: "/logo.svg", label: "Avatar URL" },+ accentColor: { type: "color", default: "#1d9bf0", label: "Accent" },+ theme: {+ type: "select",+ default: "light",+ options: ["light", "dark"],+ label: "Theme",+ },+ background: {+ type: "select",+ default: "surface",+ options: ["surface", "transparent"],+ label: "Background",+ },+ orientation: {+ type: "select",+ default: "horizontal",+ options: ["horizontal", "vertical"],+ label: "Orientation",+ },+ // `speed` is appended from SHARED_CONTROLS in registry/__index__.tsx.+ // `notifications` is an array → not a control; preview uses SAMPLE_FOLLOWERS.+ },+ durationInFrames: 360,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+};diff --git a/registry/remocn/x-followers-overview/index.tsx b/registry/remocn/x-followers-overview/index.tsxnew file mode 100644index 00000000..ce5664fc--- /dev/null+++ b/registry/remocn/x-followers-overview/index.tsx@@ -0,0 +1,560 @@+"use client";++import { useState } from "react";+import { loadFont as loadSans } from "@remotion/google-fonts/Manrope";+import {+ AbsoluteFill,+ Easing,+ Img,+ interpolate,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from "remotion";+import { Confetti } from "@/components/remocn/confetti";++export interface FollowerNotification {+ name: string;+ verified: boolean;+ /** Relative time label, e.g. "7h", "1d". */+ time: string;+}++export interface XFollowersOverviewProps {+ notifications?: FollowerNotification[];+ totalFollowers?: number;+ handle?: string;+ avatarUrl?: string;+ accentColor?: string;+ theme?: "light" | "dark";+ orientation?: "horizontal" | "vertical";+ background?: "surface" | "transparent";+ speed?: number;+}++const { fontFamily: SANS_FAMILY } = loadSans();+const FONT_FAMILY = SANS_FAMILY;++interface Theme {+ bg: string;+ fg: string;+ fgMuted: string;+ border: string;+}++const THEMES: Record<"light" | "dark", Theme> = {+ light: {+ bg: "#ffffff",+ fg: "#0f1419",+ fgMuted: "#536471",+ border: "#eff3f4",+ },+ dark: {+ bg: "#0a0a0a",+ fg: "#e7e9ea",+ fgMuted: "#71767b",+ border: "#2f3336",+ },+};++/**+ * Hardcoded sample notifications so the composition renders immediately from+ * defaults. A future revision swaps this for live X API data.+ */+export const SAMPLE_FOLLOWERS: FollowerNotification[] = [+ { name: "Andre Vitorio", verified: true, time: "7h" },+ { name: "Sarah Chen", verified: true, time: "7h" },+ { name: "marcus", verified: false, time: "8h" },+ { name: "Lena Powell", verified: true, time: "9h" },+ { name: "dev_jay", verified: false, time: "10h" },+ { name: "Priya Nair", verified: true, time: "11h" },+ { name: "Tomás Rivera", verified: true, time: "13h" },+ { name: "hana.eth", verified: false, time: "15h" },+ { name: "Will Carter", verified: true, time: "18h" },+ { name: "Yuki Tanaka", verified: true, time: "21h" },+ { name: "benoit", verified: false, time: "23h" },+ { name: "Amara Okafor", verified: true, time: "1d" },+ { name: "Leo Martins", verified: true, time: "1d" },+ { name: "sol", verified: false, time: "2d" },+];++// --- Pure helpers (unit-tested) -------------------------------------------++/** Map an effective frame to the active notification index + in-slot fraction. */+export function slotProgress(+ fc: number,+ slotFrames: number,+ count: number,+): { idx: number; frac: number } {+ if (slotFrames <= 0 || count <= 0) return { idx: 0, frac: 0 };+ const pos = fc / slotFrames;+ const idx = Math.max(0, Math.min(Math.floor(pos), count - 1));+ const frac = Math.max(0, Math.min(pos - idx, 1));+ return { idx, frac };+}++/** Smoothstep flip ramp: rest for `hold` of the slot, then flip 0→1. */+export function flipEase(frac: number, hold: number): number {+ if (hold >= 1) return 0;+ const raw = (frac - hold) / (1 - hold);+ const c = Math.max(0, Math.min(raw, 1));+ return c * c * (3 - 2 * c);+}++export function blurIn(+ frame: number,+ start: number,+ end: number,+): { blur: number; opacity: number; translateY: number } {+ const range: [number, number] = [start, end];+ const opts = {+ extrapolateLeft: "clamp" as const,+ extrapolateRight: "clamp" as const,+ };+ return {+ blur: interpolate(frame, range, [10, 0], opts),+ opacity: interpolate(frame, range, [0, 1], opts),+ translateY: interpolate(frame, range, [12, 0], opts),+ };+}++// --- Sub-components --------------------------------------------------------++function VerifiedBadge({ accent, size }: { accent: string; size: number }) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 22 22"+ width={size}+ height={size}+ fill={accent}+ style={{ flexShrink: 0 }}+ >+ <title>Verified</title>+ <path d="M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z" />+ </svg>+ );+}++function Avatar({+ avatarUrl,+ handle,+ size,+ theme,+}: {+ avatarUrl: string;+ handle: string;+ size: number;+ theme: Theme;+}) {+ const [errored, setErrored] = useState(false);+ const ringStyle = {+ width: size,+ height: size,+ borderRadius: 9999,+ border: `1px solid ${theme.border}`,+ flexShrink: 0,+ } as const;++ if (errored || !avatarUrl) {+ return (+ <div+ style={{+ ...ringStyle,+ background: theme.border,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ color: theme.fgMuted,+ fontSize: size * 0.42,+ fontWeight: 700,+ fontFamily: FONT_FAMILY,+ }}+ >+ {handle.charAt(0).toUpperCase()}+ </div>+ );+ }++ return (+ <Img+ src={avatarUrl}+ crossOrigin="anonymous"+ onError={() => setErrored(true)}+ style={{ ...ringStyle, objectFit: "cover" }}+ />+ );+}++/** Username + verified badge — the only part that flips. Absolutely overlaid+ * and centered inside a slot sized to the active name, so the line as a whole+ * stays centered while names swap. */+function NameBlock({+ item,+ fontSize,+ height,+ theme,+ accent,+ deg,+ opacity,+}: {+ item: FollowerNotification;+ fontSize: number;+ height: number;+ theme: Theme;+ accent: string;+ deg: number;+ opacity: number;+}) {+ return (+ <div+ style={{+ position: "absolute",+ left: 0,+ right: 0,+ top: 0,+ height,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ gap: fontSize * 0.2,+ whiteSpace: "nowrap",+ transformOrigin: "center",+ backfaceVisibility: "hidden",+ transform: `rotateX(${deg}deg)`,+ opacity,+ }}+ >+ <span+ style={{+ fontFamily: FONT_FAMILY,+ fontSize,+ fontWeight: 800,+ color: theme.fg,+ lineHeight: 1,+ }}+ >+ {item.name}+ </span>+ {item.verified && (+ <VerifiedBadge accent={accent} size={fontSize * 0.66} />+ )}+ </div>+ );+}++// --- Main composition ------------------------------------------------------++export function XFollowersOverview({+ notifications = SAMPLE_FOLLOWERS,+ totalFollowers = 1709,+ handle = "remocn",+ avatarUrl = "/logo.svg",+ accentColor = "#1d9bf0",+ theme = "light",+ orientation = "horizontal",+ background = "surface",+ speed = 1,+}: XFollowersOverviewProps) {+ const frame = useCurrentFrame();+ const { durationInFrames, width, height, fps } = useVideoConfig();+ const t = THEMES[theme] ?? THEMES.light;+ const isVertical = orientation === "vertical";++ const refW = isVertical ? 720 : 1280;+ const refH = isVertical ? 1280 : 720;+ const stageScale = Math.min(width / refW, height / refH);++ const notifSize = isVertical ? 38 : 46;+ const countNum = isVertical ? 92 : 110;+ const countLabel = isVertical ? 40 : 46;+ const perspective = isVertical ? 1000 : 1200;+ const stageH = isVertical ? 160 : 180;+ const lineH = notifSize * 1.4;+ // Fast cadence: ~0.43s per username at speed 1; flip occupies the back half.+ const SLOT = 13;+ const HOLD = 0.45;++ const fc = frame * speed;+ const items = notifications.length > 0 ? notifications : SAMPLE_FOLLOWERS;+ const count = items.length;++ // Notifications cycle first, then the total blurs in. The reveal starts once+ // the list is exhausted, capped so it always fits before the timeline ends.+ const revealStart = Math.min(+ count * SLOT,+ Math.round(durationInFrames * 0.82),+ );++ const { idx, frac } = slotProgress(fc, SLOT, count);+ const flipP = flipEase(frac, HOLD);+ const hasNext = idx + 1 < count;++ const current = items[idx];+ const next = hasNext ? items[idx + 1] : undefined;+ const activeItem = flipP >= 0.5 && next ? next : current;++ const currentDeg = hasNext ? -90 * flipP : 0;+ const currentOpacity = hasNext+ ? interpolate(flipP, [0, 0.55], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })+ : 1;+ const nextDeg = 90 * (1 - flipP);+ const nextOpacity = interpolate(flipP, [0.45, 1], [0, 1], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ });++ const notifOpacity = interpolate(+ fc,+ [revealStart - 4, revealStart + 8],+ [1, 0],+ { extrapolateLeft: "clamp", extrapolateRight: "clamp" },+ );+ const countIn = blurIn(fc, revealStart + 4, revealStart + 28);+ // Dynamic pop: spring overshoot on the total as it blurs in.+ const revealSpring = spring({+ fps,+ frame: fc - (revealStart + 2),+ config: { damping: 10, stiffness: 170, mass: 0.8 },+ });+ const revealScale = interpolate(revealSpring, [0, 1], [0.5, 1]);++ // Avatar + handle reveal in sync with the total: same window as countIn,+ // avatar sliding in from the left, handle from the right.+ const avatarSize = isVertical ? 72 : 64;+ const handleSize = isVertical ? 30 : 34;+ const avatarIn = blurIn(fc, revealStart + 4, revealStart + 28);+ const handleIn = avatarIn;+ const slideOpts = {+ extrapolateLeft: "clamp" as const,+ extrapolateRight: "clamp" as const,+ };+ const avatarX = interpolate(+ fc,+ [revealStart + 4, revealStart + 28],+ [-36, 0],+ slideOpts,+ );+ const handleX = interpolate(+ fc,+ [revealStart + 4, revealStart + 28],+ [36, 0],+ slideOpts,+ );++ // Confetti fires on the real frame the reveal begins (sync across speeds),+ // centered on the canvas.+ const confettiStart = Math.round((revealStart + 2) / speed);+ const confettiColors = [+ accentColor,+ "#ff5da2",+ "#ffd23f",+ "#22c55e",+ "#a855f7",+ ];++ const pageBg = background === "transparent" ? "transparent" : t.bg;++ return (+ <AbsoluteFill style={{ background: pageBg }}>+ <div+ style={{+ position: "absolute",+ left: "50%",+ top: "50%",+ width: refW,+ height: refH,+ transform: `translate(-50%, -50%) scale(${stageScale})`,+ }}+ >+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ }}+ >+ <div style={{ position: "relative", width: refW, height: stageH }}>+ {/* Cycling notifications — only the username flips in 3D, the+ "followed you · <time>" suffix stays put. */}+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ gap: notifSize * 0.28,+ opacity: notifOpacity,+ }}+ >+ <div+ style={{+ position: "relative",+ height: lineH,+ perspective,+ display: "inline-flex",+ }}+ >+ {/* Invisible spacer sizes the slot to the active name so the+ whole line stays centered; flips overlay it absolutely. */}+ <div+ aria-hidden="true"+ style={{+ visibility: "hidden",+ display: "flex",+ alignItems: "center",+ gap: notifSize * 0.2,+ whiteSpace: "nowrap",+ fontFamily: FONT_FAMILY,+ fontSize: notifSize,+ fontWeight: 800,+ }}+ >+ {activeItem.name}+ {activeItem.verified && (+ <span style={{ width: notifSize * 0.66 }} />+ )}+ </div>+ <NameBlock+ item={current}+ fontSize={notifSize}+ height={lineH}+ theme={t}+ accent={accentColor}+ deg={currentDeg}+ opacity={currentOpacity}+ />+ {next && (+ <NameBlock+ item={next}+ fontSize={notifSize}+ height={lineH}+ theme={t}+ accent={accentColor}+ deg={nextDeg}+ opacity={nextOpacity}+ />+ )}+ </div>+ <span+ style={{+ fontFamily: FONT_FAMILY,+ fontSize: notifSize,+ fontWeight: 500,+ color: t.fgMuted,+ whiteSpace: "nowrap",+ lineHeight: 1,+ }}+ >+ followed you · {activeItem.time}+ </span>+ </div>++ {/* Total reveal: avatar + handle above the count */}+ <div+ style={{+ position: "absolute",+ inset: 0,+ display: "flex",+ flexDirection: "column",+ alignItems: "center",+ justifyContent: "center",+ gap: isVertical ? 26 : 22,+ }}+ >+ <div+ style={{+ display: "flex",+ alignItems: "center",+ gap: 14,+ }}+ >+ <div+ style={{+ opacity: avatarIn.opacity,+ filter:+ avatarIn.blur > 0 ? `blur(${avatarIn.blur}px)` : "none",+ transform: `translateX(${avatarX}px)`,+ }}+ >+ <Avatar+ avatarUrl={avatarUrl}+ handle={handle}+ size={avatarSize}+ theme={t}+ />+ </div>+ <span+ style={{+ fontFamily: FONT_FAMILY,+ fontSize: handleSize,+ fontWeight: 700,+ color: t.fg,+ whiteSpace: "nowrap",+ opacity: handleIn.opacity,+ filter:+ handleIn.blur > 0 ? `blur(${handleIn.blur}px)` : "none",+ transform: `translateX(${handleX}px)`,+ }}+ >+ @{handle}+ </span>+ </div>++ <div+ style={{+ display: "flex",+ alignItems: "baseline",+ justifyContent: "center",+ gap: 18,+ opacity: countIn.opacity,+ filter: countIn.blur > 0 ? `blur(${countIn.blur}px)` : "none",+ transform: `translateY(${countIn.translateY}px) scale(${revealScale})`,+ }}+ >+ <span+ style={{+ fontFamily: FONT_FAMILY,+ fontSize: countNum,+ fontWeight: 800,+ color: t.fg,+ letterSpacing: "-0.03em",+ fontVariantNumeric: "tabular-nums",+ lineHeight: 1,+ }}+ >+ {totalFollowers.toLocaleString("en-US")}+ </span>+ <span+ style={{+ fontFamily: FONT_FAMILY,+ fontSize: countLabel,+ fontWeight: 500,+ color: t.fgMuted,+ lineHeight: 1,+ }}+ >+ Followers+ </span>+ </div>+ </div>+ </div>+ </div>+ </div>++ <Confetti+ startFrame={confettiStart}+ originX={0.5}+ originY={0.5}+ colors={confettiColors}+ particleCount={160}+ />+ </AbsoluteFill>+ );+}diff --git a/tsconfig.json b/tsconfig.jsonindex e176a301..fd4bbc54 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -36,6 +36,7 @@"@/components/remocn/use-select-item-transition": ["./registry/remocn-ui/select-item/use-select-item-transition.ts"],"@/components/remocn/use-slider-transition": ["./registry/remocn-ui/slider/use-slider-transition.ts"],"@/components/remocn/use-blur-in-transition": ["./registry/remocn-ui/blur-in/use-blur-in-transition.ts"],+ "@/components/remocn/confetti": ["./registry/remocn/confetti/index.tsx"],"@/components/remocn/*": ["./registry/remocn-ui/*/index.tsx"],"@/*": ["./*"]}