Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added x-follow card
dev_wandryb08817ce9642
diff --git a/config/site.ts b/config/site.tsindex db47d510..8db58761 100644--- a/config/site.ts+++ b/config/site.ts@@ -41,6 +41,7 @@ export const NAV_LINKS: NavLink[] = [*/export const NEW_BADGE_PATHS = new Set<string>(["/docs/social/github-stars",+ "/docs/social/x-follow-card",]);export const FOOTER_NAV: NavLink[] = [diff --git a/content/docs/social/index.mdx b/content/docs/social/index.mdxindex 06e9789c..3b7f4617 100644--- a/content/docs/social/index.mdx+++ b/content/docs/social/index.mdx@@ -13,5 +13,11 @@ Ready-to-install compositions that turn GitHub stats, product launches, and commstatus: "stable",href: "/docs/social/github-stars",},+ {+ name: "XFollowCard",+ description: "Animated X profile follow card with cursor-driven Follow transition",+ status: "stable",+ href: "/docs/social/x-follow-card",+ },]}/>diff --git a/content/docs/social/meta.json b/content/docs/social/meta.jsonindex e62b3de2..889537f3 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"]+ "pages": ["index", "github-stars", "x-follow-card"]}diff --git a/content/docs/social/x-follow-card.mdx b/content/docs/social/x-follow-card.mdxnew file mode 100644index 00000000..36283f5e--- /dev/null+++ b/content/docs/social/x-follow-card.mdx@@ -0,0 +1,145 @@+---+title: X Follow Card+description: Animated X profile follow card with spring bounce-in, staggered blur-in, and cursor-driven Follow transition+---++<ComponentPreview name="x-follow-card" />++## Installation++<InstallBlock name="x-follow-card" />++<Note>+ Installing `x-follow-card` automatically pulls the `cursor` primitive as a dependency via `registryDependencies`. No additional install needed.+</Note>++## Usage++Standalone in a Remotion `<Composition>` — uses sample profile data so the video renders immediately after install:++```tsx+// src/Root.tsx+import { Composition } from "remotion";+import { XFollowCard } from "@/components/remocn/x-follow-card";++const XFollowCardScene = () => (+ <XFollowCard+ name="Co-Lab"+ handle="co-lab"+ accentColor="#1d9bf0"+ theme="light"+ orientation="horizontal"+ speed={1}+ />+);++export const RemotionRoot = () => (+ <Composition+ id="XFollowCard"+ component={XFollowCardScene}+ durationInFrames={165}+ fps={30}+ width={1280}+ height={720}+ />+);+```++Timeline: card bounces in (0–25), layers blur in staggered (20–70), cursor travels to the Follow button (75–110), clicks and transitions to "Following" (110), then holds (130–165).++## Props++<PropsTable+ rows={[+ {+ name: "name",+ type: "string",+ default: "\"Dmitri K\"",+ description: "Display name shown above the handle",+ },+ {+ name: "handle",+ type: "string",+ default: "\"kapishdima\"",+ description: "X username (without the @)",+ },+ {+ name: "bio",+ type: "string",+ default: "\"Building video tools with Remotion\"",+ description: "Multi-line profile description",+ },+ {+ name: "location",+ type: "string",+ default: "\"Earth\"",+ description: "Location shown in meta row (optional)",+ },+ {+ name: "website",+ type: "string",+ default: "\"remocn.dev\"",+ description: "Website URL shown in meta row (optional)",+ },+ {+ name: "joined",+ type: "string",+ default: "\"Joined January 2023\"",+ description: "Account creation date shown in meta row",+ },+ {+ name: "avatarUrl",+ type: "string",+ default: "\"\"",+ description: "Profile picture URL — defaults to gradient fallback if empty",+ },+ {+ name: "coverUrl",+ type: "string",+ default: "\"\"",+ description: "Header image URL — defaults to accent-color gradient if empty",+ },+ {+ name: "verified",+ type: "boolean",+ default: "true",+ description: "Whether to show X verification badge next to name",+ },+ {+ name: "accentColor",+ type: "string",+ default: "\"#1d9bf0\"",+ description: "X brand blue — used for button fill, badge, and cursor ripple",+ },+ {+ name: "theme",+ type: "\"light\" | \"dark\"",+ default: "\"light\"",+ description: "Color theme for the card background and text",+ },+ {+ name: "background",+ type: "\"surface\" | \"transparent\"",+ default: "\"surface\"",+ description: "Card background — surface renders white (light) or dark gray (dark); transparent shows no background",+ },+ {+ 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 (prevents click frame loss)",+ },+ ]}+/>++## Notes++- **Offline rendering:** avatarUrl and coverUrl default to empty strings, which render gradient fallbacks. No network requests are made, so the preview works offline and MP4 export requires no CORS setup.+- **Sample post:** The hardcoded post at the bottom shows a representative engagement example. In v1, post content is not customizable.+- **Button state:** The Follow button transitions from solid accent-color to "Following" (white bg, gray border, black text) when the cursor clicks at frame ~110.diff --git a/public/imgs/x-cover.png b/public/imgs/x-cover.pngnew file mode 100644index 00000000..065831d2Binary files /dev/null and b/public/imgs/x-cover.png differdiff --git a/registry/__index__.tsx b/registry/__index__.tsxindex b3338c6c..96c9ff9f 100644--- a/registry/__index__.tsx+++ b/registry/__index__.tsx@@ -95,6 +95,8 @@ import { TrackingIn } from "@/registry/remocn/tracking-in";import { trackingInConfig } from "@/registry/remocn/tracking-in/config";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 { Accordion } from "@/registry/remocn-ui/accordion";import { accordionConfig } from "@/registry/remocn-ui/accordion/config";import { AlertDialog } from "@/registry/remocn-ui/alert-dialog";@@ -315,6 +317,7 @@ const registry: Record<string, RegistryEntry> = {config: imageExpandToFullscreenConfig,},"github-stars": { Component: GitHubStars, config: githubStarsConfig },+ "x-follow-card": { Component: XFollowCard, config: xFollowCardConfig },"button": { Component: Button, config: buttonConfig },"accordion": { Component: Accordion, config: accordionConfig },"alert-dialog": { Component: AlertDialog, config: alertDialogConfig },@@ -412,4 +415,16 @@ if (githubStars) {};}+const xFollowCard = registry["x-follow-card"];+if (xFollowCard) {+ xFollowCard.config.controls.speed = {+ type: "number",+ default: 1,+ min: 1,+ max: 4,+ step: 0.25,+ label: "Speed",+ };+}+export default registry;diff --git a/registry/remocn/SOCIAL_FOLLOW_STYLEGUIDE.md b/registry/remocn/SOCIAL_FOLLOW_STYLEGUIDE.mdnew file mode 100644index 00000000..4b5688f1--- /dev/null+++ b/registry/remocn/SOCIAL_FOLLOW_STYLEGUIDE.md@@ -0,0 +1,265 @@+# Social Follow-Card Style Guide++**Status:** Author-facing contract for the `*-follow-card` family. Never shipped to users; lives beside sources as the reference implementation. New cards reference this guide + copy the folder structure.++---++## 1. Shared Anatomy++All follow-card variants render 9 layers in this fixed order:++1. **Cover** — full-width background image (fallback: accent-color gradient)+2. **Avatar** — square profile picture, overlaid bottom-left+3. **Name + Verified** — large text, with optional verification badge+4. **@Handle** — smaller secondary text, muted color+5. **Bio** — multi-line description, muted color+6. **Meta Row** — location · website · joined, small gray text+7. **Button Row** — two buttons: Follow + Message (custom 2-state Follow, standard Message)+8. **Tabs** — Posts (active), Media, Likes (inactive tabs, no interaction in v1)+9. **Sample Post** — hardcoded single post with avatar, timestamp, text (no fetch in v1)++Each layer has an entrance animation (see timeline below). The card is centered in the viewport with a spring bounce-in transform.++---++## 2. Timeline Budget++**Total duration:** 165 frames @ 30fps (5.5 seconds).++| Phase | Frames | Action |+|-------|--------|--------|+| Bounce-in | 0–25 | Card enters: `translateY` +60→0, `scale` 0.9→1 (spring overshoot) |+| Staggered blur-in | 20–70 | 9 layers enter with staggered blur + opacity + translateY (each group offset ~5–6 frames) |+| Cursor travel | 75–~110 | Cursor pointer moves to Follow button, no interaction |+| Click + Flip | ~110 | Cursor clicks; button flips from "Follow" (solid accent) → "Following" (white bg, gray border, black text) |+| Hold | 130–165 | Card holds in final state |++**Critical rule: Click must fit the budget**++The follow state transition (click → flip) must complete **before** frame 165. To guarantee this:+- Define a shared `CLICK_FRAME ≈ 110` constant (exact frame where cursor clicks and button state flips)+- Cap `speed` slider to `min: 1` in `registry/__index__.tsx`+- Verify at build time: `CLICK_FRAME / speed_min ≤ durationInFrames` → `110 / 1 ≤ 165` ✓++At `speed < 1`, the animation slows but `frame * speed` may never reach `CLICK_FRAME`, leaving the button stuck as "Follow". Always enforce `min: 1`.++---++## 3. Control-Naming Contract++All follow-card variants expose **identical control keys** for portability across networks:++**Profile data (all string except verified):**+- `name` — display name+- `handle` — @username (without @)+- `bio` — multi-line description+- `location` — city/region (optional)+- `website` — link URL (optional)+- `joined` — date string (e.g. "Joined March 2023")+- `avatarUrl` — image URL (defaults to `""` → gradient fallback)+- `coverUrl` — image URL (defaults to `""` → gradient fallback)+- `verified` — boolean (default: `true`)++**Theming & interaction:**+- `accentColor` — brand color (hex, default per network; e.g. `"#1d9bf0"` for X)+- `theme` — `"light"` | `"dark"` (default: `"light"`)+- `background` — `"surface"` | `"transparent"` (default: `"surface"`)+- `orientation` — `"horizontal"` | `"vertical"` (default: `"horizontal"`)++**Animation (shared across all compositions):**+- `speed` — speed multiplier (default: `1`, min: `1`)++**NOT controls:**+- Sample post content is **hardcoded** — do not expose as controls in v1. The post text, timestamp, and engagement counts are baked into the component.++---++## 4. Theming Tokens++Define a `THEMES` object mapping theme name → token set:++```typescript+type Theme = {+ cardBg: string; // Background of the card itself+ cardBorder: string; // Border color (1px)+ fg: string; // Foreground (primary text)+ fgMuted: string; // Secondary text (handle, bio, meta)+ divider: string; // Horizontal lines+};++const THEMES: Record<"light" | "dark", Theme> = {+ light: {+ cardBg: "#ffffff",+ cardBorder: "#e1e8ed",+ fg: "#000000",+ fgMuted: "#657786",+ divider: "#e1e8ed",+ },+ dark: {+ cardBg: "#15202b",+ cardBorder: "#38444d",+ fg: "#ffffff",+ fgMuted: "#8899a6",+ divider: "#38444d",+ },+};+```++**`accentColor` is a separate axis** — it does NOT depend on theme. Pass it independently and apply it to:+- Follow button fill (solid, before click)+- Verification badge (if present)+- Links (optional)+- Cover gradient (if no image)+- Cursor ripple (render `rippleColor={accentColor}`)++---++## 5. Cursor + Custom Button Interaction++The follow card is the first remocn composition using an interactive cursor and custom button state.++### Cursor placement & coordinate space+- Mount the `<Cursor>` component **inside the scaled card ref-stage** (same parent as the `Card`, both children of a centered transform container)+- Both the card and cursor share the same coordinate space: ref-stage pixels+- Do NOT use unscaled pixels (avoid signup-flow's pattern); instead, derive the cursor's target from a shared `BUTTON_LAYOUT` constant+- `BUTTON_LAYOUT` contains the button center in ref-pixels for each orientation++### Button interaction+- Define a pure helper `followStateAt(frame: number, speed: number): boolean` that returns `true` once `frame * speed >= CLICK_FRAME`+- Before the click: button text = "Follow", background = `accentColor` (solid), text = white+- After the click: button text = "Following", background = white, border = 1px gray, text = black+- **No chevron, no checkmark** — state is text-only++### Cursor styling+- Render: `<Cursor variant="pointer" mode={theme} rippleColor={accentColor} style={useCursorPath(...)} />`+- The ripple animates at the exact `CLICK_FRAME` and should land **on the Follow button** in both horizontal and vertical orientations+- Use a shared `buildFollowWaypoints()` helper to compute cursor waypoints, ensuring the click waypoint targets the button center++---++## 6. Per-Network Reference Table++**Author-time verification note:** The values below are starting points extracted from each platform's public profiles. Before shipping a new *-follow-card, confirm accent color, badge style, button labels, and secondary action against a live profile on the target network.++| Network | Accent | Badge | Primary Button | Secondary |+|---------|--------|-------|---|---|+| **X** | `#1d9bf0` | Seal (✓) | Follow→Following | Message |+| **Instagram** | `#E1306C` | Seal (✓) | Follow→Following (chevron) | Message |+| **LinkedIn** | `#0A66C2` | None | Connect→Pending¹ | Message |+| **GitHub** | `#1f2328` or accent | None | Follow→Following | Sponsor |+| **YouTube** | `#FF0000` | Check (✓) | Subscribe→Subscribed | Join |+| **TikTok** | `#FE2C55` | Check (✓) | Follow→Following | Message |++¹ **LinkedIn footnote:** "Connect→Pending" applies to personal profiles. Creator and company profiles use "Follow→Following" instead. Confirm against the target profile type at authoring time.++---++## 7. Offline-Default Rule++The card must render **without network requests**. Define these fallbacks:++- **`avatarUrl` default:** empty string `""` → render a gradient block (e.g. linear-gradient using accentColor)+- **`coverUrl` default:** empty string `""` → render a solid gradient or pattern+- **Provided URLs:** render via `<Img src={url} crossOrigin="anonymous" onError={fallback} />`++This ensures:+1. The docs preview works on page load (no CORS, no async fetch)+2. Headless MP4 export via `@remotion/renderer` works without external resources+3. Users can test offline in development++---++## 8. Registry Dependencies & Import Constraints++The follow-card imports two remocn primitives:++```typescript+import { Cursor } from "@/components/remocn/cursor";+import { useCursorPath } from "@/components/remocn/use-cursor-path";+```++**In `registry/remocn/registry.json`:**+```json+{+ "dependencies": ["remotion", "@remotion/google-fonts"],+ "registryDependencies": ["@remocn/cursor"],+ "files": [{ "path": "x-follow-card/index.tsx", "target": "components/remocn/x-follow-card.tsx" }]+}+```++The cursor primitive is a **registryDependency** (shipped via `npx shadcn add`). The `useCursorPath` hook resolves transitively via the cursor's own registry definition.++**Constraint:** The tsconfig.json `@/components/remocn/*` glob matches single-segment paths only. Do NOT import deeper siblings like `use-cursor-path/helpers`. Instead, `useCursorPath` and `Cursor` are the public API surfaces; anything deeper belongs inside their modules, not in the follow-card's source.++---++## 9. Architecture & Extraction Seam ADR++**Decision:** v1 ships as a single-file `index.tsx` with 5 exported helper functions and a shared `CLICK_FRAME` constant. This is the designated **extraction seam** for the follow-card family.++**Exported pure helpers (unit-testable):**+1. `cardBounceIn(frame: number, fps: number)` → `{ translateY: number; scale: number }` — spring entrance over frames 0–25+2. `blurInSchedule()` → `BlurInStep[]` — returns 9 ordered groups (one per anatomy layer) with entry frame ranges within [20, 70]+3. `blurInAt(step: BlurInStep, frame: number)` → `{ blur: number; opacity: number; translateY: number }` — interpolates a single layer's entrance+4. `followStateAt(frame: number, speed: number)` → `boolean` — true once `frame * speed >= CLICK_FRAME`+5. `buildFollowWaypoints(opts: { buttonCenter: { x: number; y: number }; orientation: "horizontal" | "vertical" })` → `CursorWaypoint[]` — cursor path to the button++**Shared constant:**+- `CLICK_FRAME: number ≈ 110` — frame at which cursor clicks and button state flips; used by helpers 4 & 5++**Why extract at card #2 (not v1):**+- v1 lowest risk: proven pattern from github-stars, single source of truth in Markdown (this guide)+- Extraction is pre-declared, so when Instagram (card #2) is built, the seam is explicit: copy-paste the folder, then move the 5 helpers + `CLICK_FRAME` to a new `@/lib/remocn-ui/social/index.ts` module+- Until extraction, the 6 author-events (name, handle, bio, etc.) cannot be enforced by TypeScript — Markdown documents the invariants, but only a shared module can make them unbreakable++---++## 10. Copy-Paste Checklist for the Next Follow-Card++When building a new *-follow-card variant (e.g., Instagram):++1. **STOP if card #2 (Instagram):** extract the 5 helpers + `CLICK_FRAME` from X's `index.tsx` into `@/lib/remocn-ui/social/index.ts` **first**. Then proceed with step 2 using the extracted module.++2. **Copy the folder:** duplicate `registry/remocn/x-follow-card/` → `registry/remocn/<network>-follow-card/`.++3. **Update component metadata:**+ - Rename `XFollowCard` → `{Network}FollowCard` (e.g., `InstagramFollowCard`)+ - Update `componentName` in `config.ts`+ - Update imports in `registry/__index__.tsx`++4. **Apply network-specific theming:**+ - Swap `accentColor` default (e.g., `#E1306C` for Instagram)+ - Update verification badge style (seal vs. check vs. none)+ - Update button labels (e.g., Instagram's Follow button shows a chevron in the "Following" state)+ - Update secondary action label++5. **Mount cursor inside scaled stage:** Ensure `<CursorLayer>` renders as a sibling of `<Card>` inside the same scaled ref-stage parent, **not** elsewhere.++6. **Derive buttonCenter from shared BUTTON_LAYOUT:** Define a `BUTTON_LAYOUT` constant per orientation and pass it to `buildFollowWaypoints()`. Verify the ripple lands on the button in both orientations before shipping.++7. **Add speed min:1 override:** Mirror the `github-stars` pattern in `registry/__index__.tsx`.++8. **Keep control keys identical:** Do NOT rename or reorder the 13 control keys (name, handle, bio, avatarUrl, coverUrl, location, website, joined, verified, accentColor, theme, background, orientation). Network-specific differences (like button labels) go in the helper text or component comments, not in the control shape.++9. **Registry dependencies:** `registryDependencies: ["@remocn/cursor"]`, `dependencies: ["remotion", "@remotion/google-fonts"]`. Ship only `index.tsx` in files[].++10. **Avoid deeper sibling imports:** Do not import `use-cursor-path/helpers` or other `@/components/remocn/*` modules at a depth > 1 segment. The tsconfig glob does not resolve them.++11. **Timeline budget:** Preserve the 165-frame, 0–110 CLICK_FRAME timeline. If a network requires a different animation pace, adjust via the exported helpers or phase offsets, but keep `CLICK_FRAME` and the envelope (0–165f) fixed.++12. **Offline defaults:** Test that avatarUrl="" and coverUrl="" render gradient fallbacks, not network errors. Verify headless MP4 export works.++13. **Documentation:** Create `content/docs/social/<network>-follow-card.mdx` (unquoted YAML frontmatter, no colon-space in title/description), add to `content/docs/social/meta.json`, add to grid in `content/docs/social/index.mdx`, add to `NEW_BADGE_PATHS` in `config/site.ts`.++14. **Unit tests:** If extraction happened at step 1, add tests for the shared helpers (cardBounceIn, blurInSchedule, etc.). v1 tests are optional; v2+ tests are load-bearing.++---++## Reference Implementation++See `registry/remocn/x-follow-card/index.tsx` for the canonical example of:+- The 5 exported helpers and `CLICK_FRAME` constant+- `THEMES` and per-orientation `BUTTON_LAYOUT` definitions+- Cursor mounted inside the scaled ref-stage+- Offline-default fallbacks for avatarUrl and coverUrl+- No deeper sibling imports (only `Cursor` and `useCursorPath` from remocn-ui)diff --git a/registry/remocn/registry.json b/registry/remocn/registry.jsonindex d310f57b..93ec1177 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -674,6 +674,21 @@"target": "components/remocn/github-stars.tsx"}]+ },+ {+ "name": "x-follow-card",+ "type": "registry:component",+ "title": "X Follow Card",+ "description": "Animated X profile follow card — spring bounce-in, staggered blur-in, a synthetic cursor that clicks Follow and flips it to Following. Light/dark, horizontal or vertical.",+ "dependencies": ["remotion", "@remotion/google-fonts"],+ "registryDependencies": ["@remocn/cursor"],+ "files": [+ {+ "path": "x-follow-card/index.tsx",+ "type": "registry:component",+ "target": "components/remocn/x-follow-card.tsx"+ }+ ]}]}diff --git a/registry/remocn/x-follow-card/config.ts b/registry/remocn/x-follow-card/config.tsnew file mode 100644index 00000000..f95647d5--- /dev/null+++ b/registry/remocn/x-follow-card/config.ts@@ -0,0 +1,49 @@+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";++export const xFollowCardConfig: ComponentConfig = {+ componentName: "XFollowCard",+ importPath: "@/components/remocn/x-follow-card",+ controls: {+ name: { type: "text", default: "remocn", label: "Name" },+ handle: { type: "text", default: "remocn", label: "Handle" },+ bio: {+ type: "text",+ default:+ "Production-ready components for Remotion - text animations, backgrounds, transitions, UI blocks, and full scene compositions",+ label: "Bio",+ },+ avatarUrl: { type: "text", default: "/logo.svg", label: "Avatar URL" },+ coverUrl: {+ type: "text",+ default: "/imgs/x-cover.png",+ label: "Cover URL",+ },+ location: { type: "text", default: "Ukraine", label: "Location" },+ website: { type: "text", default: "remocn.dev", label: "Website" },+ joined: { type: "text", default: "January 2024", label: "Joined" },+ verified: { type: "boolean", default: true, label: "Verified" },+ 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",+ },+ },+ durationInFrames: 165,+ fps: FPS,+ compositionWidth: W,+ compositionHeight: H,+};diff --git a/registry/remocn/x-follow-card/index.tsx b/registry/remocn/x-follow-card/index.tsxnew file mode 100644index 00000000..a23a5400--- /dev/null+++ b/registry/remocn/x-follow-card/index.tsx@@ -0,0 +1,881 @@+"use client";++import { useState } from "react";+import { loadFont } from "@remotion/google-fonts/Inter";+import {+ AbsoluteFill,+ Img,+ interpolate,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from "remotion";+import { Cursor, type CursorStyle } from "@/components/remocn/cursor";+import {+ type CursorWaypoint,+ useCursorPath,+} from "@/components/remocn/use-cursor-path";++const { fontFamily: FONT_FAMILY } = loadFont();++export interface XFollowCardProps {+ name?: string;+ handle?: string;+ bio?: string;+ avatarUrl?: string;+ coverUrl?: string;+ location?: string;+ website?: string;+ joined?: string;+ verified?: boolean;+ accentColor?: string;+ theme?: "light" | "dark";+ background?: "surface" | "transparent";+ orientation?: "horizontal" | "vertical";+ speed?: number;+}++interface Theme {+ page: string;+ cardBg: string;+ cardBorder: string;+ fg: string;+ fgMuted: string;+ divider: string;+}++export const THEMES: Record<"light" | "dark", Theme> = {+ light: {+ page: "#f5f7f9",+ cardBg: "#ffffff",+ cardBorder: "#e6e9eb",+ fg: "#0f1419",+ fgMuted: "#536471",+ divider: "#eff3f4",+ },+ dark: {+ page: "#0a0a0a",+ cardBg: "#16181c",+ cardBorder: "#2f3336",+ fg: "#e7e9ea",+ fgMuted: "#71767b",+ divider: "#2f3336",+ },+};++export const CLICK_FRAME = 110;++const BUTTON_LAYOUT: Record<+ "horizontal" | "vertical",+ { x: number; y: number; w: number; h: number }+> = {+ horizontal: { x: 800, y: 240, w: 116, h: 40 },+ vertical: { x: 542, y: 336, w: 124, h: 44 },+};++export function cardBounceIn(+ frame: number,+ fps: number,+): { translateY: number; scale: number } {+ const s = spring({+ fps,+ frame,+ config: { damping: 12, stiffness: 120, mass: 0.8 },+ });+ const translateY = interpolate(s, [0, 1], [60, 0]);+ const scale = interpolate(s, [0, 1], [0.9, 1]);+ return { translateY, scale };+}++export function blurInSchedule(): {+ group: number;+ start: number;+ end: number;+}[] {+ return [+ { group: 0, start: 20, end: 26 },+ { group: 1, start: 22, end: 28 },+ { group: 2, start: 24, end: 30 },+ { group: 3, start: 26, end: 32 },+ { group: 4, start: 28, end: 34 },+ { group: 5, start: 30, end: 36 },+ { group: 6, start: 32, end: 38 },+ { group: 7, start: 34, end: 40 },+ { group: 8, start: 36, end: 42 },+ ];+}++export function blurInAt(+ step: { start: number; end: number },+ frame: number,+): { blur: number; opacity: number; translateY: number } {+ const range: [number, number] = [step.start, step.end];+ const opts = {+ extrapolateLeft: "clamp" as const,+ extrapolateRight: "clamp" as const,+ };+ return {+ blur: interpolate(frame, range, [8, 0], opts),+ opacity: interpolate(frame, range, [0, 1], opts),+ translateY: interpolate(frame, range, [8, 0], opts),+ };+}++export function followStateAt(frame: number, speed: number): boolean {+ return frame * speed >= CLICK_FRAME;+}++export function buildFollowWaypoints(args: {+ buttonCenter: { x: number; y: number };+ orientation: "horizontal" | "vertical";+}): CursorWaypoint[] {+ const { buttonCenter, orientation } = args;+ const rest =+ orientation === "vertical" ? { x: 640, y: 1120 } : { x: 1120, y: 600 };+ return [+ { at: 0, x: rest.x, y: rest.y },+ { at: 75, x: rest.x, y: rest.y },+ {+ at: CLICK_FRAME,+ x: buttonCenter.x,+ y: buttonCenter.y,+ duration: 32,+ click: true,+ easing: "inOut",+ },+ { at: CLICK_FRAME + 30, x: buttonCenter.x, y: buttonCenter.y },+ ];+}++function tintGradient(accent: string): string {+ return `linear-gradient(135deg, ${accent} 0%, ${accent}99 55%, ${accent}55 100%)`;+}++function Cover({+ coverUrl,+ accent,+ height,+}: {+ coverUrl: string;+ accent: string;+ height: number;+}) {+ const [errored, setErrored] = useState(false);+ const fallback = (+ <div+ style={{+ width: "100%",+ height,+ background: tintGradient(accent),+ }}+ />+ );+ if (errored || !coverUrl) return fallback;+ return (+ <Img+ src={coverUrl}+ crossOrigin="anonymous"+ onError={() => setErrored(true)}+ style={{ width: "100%", height, objectFit: "cover", display: "block" }}+ />+ );+}++function Avatar({+ avatarUrl,+ name,+ size,+ accent,+ theme,+}: {+ avatarUrl: string;+ name: string;+ size: number;+ accent: string;+ theme: Theme;+}) {+ const [errored, setErrored] = useState(false);+ const ringStyle = {+ width: size,+ height: size,+ borderRadius: "100%",+ border: `4px solid ${theme.cardBg}`,+ flexShrink: 0,+ boxSizing: "border-box" as const,+ };++ if (errored || !avatarUrl) {+ return (+ <div+ style={{+ ...ringStyle,+ background: `${accent}33`,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ color: accent,+ fontSize: size * 0.4,+ fontWeight: 700,+ fontFamily: FONT_FAMILY,+ }}+ >+ {name.charAt(0).toUpperCase()}+ </div>+ );+ }++ return (+ <Img+ src={avatarUrl}+ crossOrigin="anonymous"+ onError={() => setErrored(true)}+ style={{ ...ringStyle, objectFit: "cover" }}+ />+ );+}++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}+ >+ <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 ProfileInfo({+ name,+ handle,+ bio,+ verified,+ accent,+ theme,+ isVertical,+ nameStyle,+ handleStyle,+ bioStyle,+}: {+ name: string;+ handle: string;+ bio: string;+ verified: boolean;+ accent: string;+ theme: Theme;+ isVertical: boolean;+ nameStyle: React.CSSProperties;+ handleStyle: React.CSSProperties;+ bioStyle: React.CSSProperties;+}) {+ return (+ <div+ style={{+ display: "flex",+ flexDirection: "column",+ gap: 2,+ marginTop: 12,+ }}+ >+ <div+ style={{ ...nameStyle, display: "flex", alignItems: "center", gap: 6 }}+ >+ <span+ style={{+ fontSize: isVertical ? 28 : 24,+ fontWeight: 800,+ color: theme.fg,+ fontFamily: FONT_FAMILY,+ lineHeight: 1.2,+ letterSpacing: "-0.01em",+ }}+ >+ {name}+ </span>+ {verified && (+ <VerifiedBadge accent={accent} size={isVertical ? 24 : 22} />+ )}+ </div>+ <span+ style={{+ ...handleStyle,+ fontSize: isVertical ? 18 : 16,+ fontWeight: 400,+ color: theme.fgMuted,+ fontFamily: FONT_FAMILY,+ lineHeight: 1.3,+ }}+ >+ @{handle}+ </span>+ <p+ style={{+ ...bioStyle,+ margin: "8px 0 0",+ fontSize: isVertical ? 18 : 16,+ fontWeight: 400,+ color: theme.fg,+ fontFamily: FONT_FAMILY,+ lineHeight: 1.4,+ display: "-webkit-box",+ WebkitLineClamp: 2,+ WebkitBoxOrient: "vertical",+ overflow: "hidden",+ }}+ >+ {bio}+ </p>+ </div>+ );+}++function MetaRow({+ location,+ website,+ joined,+ accent,+ theme,+}: {+ location: string;+ website: string;+ joined: string;+ accent: string;+ theme: Theme;+}) {+ const itemStyle = {+ display: "flex",+ alignItems: "center",+ gap: 6,+ fontSize: 15,+ color: theme.fgMuted,+ fontFamily: FONT_FAMILY,+ } as const;+ return (+ <div+ style={{+ display: "flex",+ flexWrap: "wrap",+ gap: 16,+ marginTop: 14,+ }}+ >+ <span style={itemStyle}>+ <PinIcon color={theme.fgMuted} />+ {location}+ </span>+ <span style={itemStyle}>+ <LinkIcon color={theme.fgMuted} />+ <span style={{ color: accent }}>{website}</span>+ </span>+ <span style={itemStyle}>+ <CalendarIcon color={theme.fgMuted} />+ {`Joined ${joined}`}+ </span>+ </div>+ );+}++function PinIcon({ color }: { color: string }) {+ return (+ <svg width={16} height={16} viewBox="0 0 24 24" fill={color}>+ <title>Location</title>+ <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5a2.5 2.5 0 110-5 2.5 2.5 0 010 5z" />+ </svg>+ );+}++function LinkIcon({ color }: { color: string }) {+ return (+ <svg width={16} height={16} viewBox="0 0 24 24" fill={color}>+ <title>Website</title>+ <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z" />+ </svg>+ );+}++function CalendarIcon({ color }: { color: string }) {+ return (+ <svg width={16} height={16} viewBox="0 0 24 24" fill={color}>+ <title>Joined</title>+ <path d="M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z" />+ </svg>+ );+}++function FollowButton({+ frame,+ speed,+ accent,+ theme,+ layout,+ pressScale,+}: {+ frame: number;+ speed: number;+ accent: string;+ theme: Theme;+ layout: { x: number; y: number; w: number; h: number };+ pressScale: number;+}) {+ const followed = followStateAt(frame, speed);+ const flip = interpolate(+ frame * speed,+ [CLICK_FRAME, CLICK_FRAME + 10],+ [0, 1],+ { extrapolateLeft: "clamp", extrapolateRight: "clamp" },+ );++ const base = {+ position: "absolute" as const,+ left: layout.x,+ top: layout.y,+ width: layout.w,+ height: layout.h,+ borderRadius: layout.h / 2,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ fontSize: 16,+ fontWeight: 700,+ fontFamily: FONT_FAMILY,+ boxSizing: "border-box" as const,+ transform: `scale(${pressScale})`,+ transformOrigin: "center",+ };++ return (+ <div style={base}>+ <div+ style={{+ position: "absolute",+ inset: 0,+ borderRadius: layout.h / 2,+ background: accent,+ color: "#ffffff",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ opacity: 1 - flip,+ }}+ >+ Follow+ </div>+ <div+ style={{+ position: "absolute",+ inset: 0,+ borderRadius: layout.h / 2,+ background: theme.cardBg,+ border: `1px solid ${theme.cardBorder}`,+ color: theme.fg,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ opacity: flip,+ }}+ >+ Following+ </div>+ </div>+ );+}++function MessageButton({+ layout,+ theme,+}: {+ layout: { x: number; y: number; size: number };+ theme: Theme;+}) {+ return (+ <div+ style={{+ position: "absolute",+ left: layout.x,+ top: layout.y,+ width: layout.size,+ height: layout.size,+ borderRadius: layout.size / 2,+ border: `1px solid ${theme.cardBorder}`,+ background: theme.cardBg,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ }}+ >+ <svg width={20} height={20} viewBox="0 0 24 24" fill={theme.fg}>+ <title>Message</title>+ <path d="M1.998 5.5c0-1.381 1.119-2.5 2.5-2.5h15c1.381 0 2.5 1.119 2.5 2.5v13c0 1.381-1.119 2.5-2.5 2.5h-15c-1.381 0-2.5-1.119-2.5-2.5v-13zm2.5-.5c-.276 0-.5.224-.5.5v2.764l8 3.638 8-3.638V5.5c0-.276-.224-.5-.5-.5h-15zm15.5 5.463l-8 3.638-8-3.638V18.5c0 .276.224.5.5.5h15c.276 0 .5-.224.5-.5v-8.037z" />+ </svg>+ </div>+ );+}++function Tabs({+ accent,+ theme,+ isVertical,+}: {+ accent: string;+ theme: Theme;+ isVertical: boolean;+}) {+ const tabs = ["Posts", "Replies", "Media", "Likes"];+ return (+ <div+ style={{+ display: "flex",+ marginTop: 0,+ columnGap: 32,+ borderBottom: `1px solid ${theme.divider}`,+ }}+ >+ {tabs.map((tab, i) => {+ const active = i === 0;+ return (+ <div+ key={tab}+ style={{+ // flex: 1,+ display: "flex",+ flexDirection: "column",+ alignItems: "flex-start",+ paddingBottom: 12,+ position: "relative",+ }}+ >+ <span+ style={{+ fontSize: isVertical ? 17 : 15,+ fontWeight: active ? 700 : 500,+ color: active ? theme.fg : theme.fgMuted,+ fontFamily: FONT_FAMILY,+ }}+ >+ {tab}+ </span>+ {active && (+ <div+ style={{+ position: "absolute",+ bottom: -1,+ height: 4,+ width: 56,+ borderRadius: 2,+ background: accent,+ }}+ />+ )}+ </div>+ );+ })}+ </div>+ );+}++function SamplePost({+ name,+ handle,+ avatarUrl,+ accent,+ theme,+}: {+ name: string;+ handle: string;+ avatarUrl: string;+ accent: string;+ theme: Theme;+}) {+ return (+ <div+ style={{+ display: "flex",+ gap: 12,+ marginTop: 16,+ }}+ >+ <Avatar+ avatarUrl={avatarUrl}+ name={name}+ size={44}+ accent={accent}+ theme={theme}+ />+ <div style={{ flex: 1, minWidth: 0 }}>+ <div+ style={{+ display: "flex",+ alignItems: "center",+ gap: 6,+ fontFamily: FONT_FAMILY,+ }}+ >+ <span style={{ fontSize: 15, fontWeight: 700, color: theme.fg }}>+ {name}+ </span>+ <span style={{ fontSize: 15, color: theme.fgMuted }}>+ {`@${handle} · 2d`}+ </span>+ </div>+ <p+ style={{+ margin: "4px 0 0",+ fontSize: 15,+ color: theme.fg,+ fontFamily: FONT_FAMILY,+ lineHeight: 1.4,+ }}+ >+ Shipping something new today. Built entirely with Remotion and a lot+ of coffee. More soon.+ </p>+ <div+ style={{+ display: "flex",+ gap: 40,+ marginTop: 10,+ color: theme.fgMuted,+ fontFamily: FONT_FAMILY,+ fontSize: 13,+ }}+ >+ <span>12</span>+ <span>48</span>+ <span>312</span>+ </div>+ </div>+ </div>+ );+}++function CursorLayer({+ theme,+ accent,+ style,+}: {+ theme: "light" | "dark";+ accent: string;+ style: CursorStyle;+}) {+ return (+ <div+ style={{+ position: "absolute",+ inset: 0,+ pointerEvents: "none",+ }}+ >+ <Cursor+ variant="pointer"+ mode={theme}+ rippleColor={accent}+ style={style}+ />+ </div>+ );+}++export function XFollowCard({+ name = "remocn",+ handle = "remocn",+ bio = "Building the collaborative video toolkit for small teams.\nShip demos faster with ready-made motion.",+ avatarUrl = "/logo.svg",+ coverUrl = "",+ location = "Tunisia",+ website = "remocn.tn",+ joined = "January 2024",+ verified = true,+ accentColor = "#1d9bf0",+ theme = "light",+ background = "surface",+ orientation = "horizontal",+ speed = 1,+}: XFollowCardProps) {+ const frame = useCurrentFrame();+ const { 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 cardWidth = isVertical ? 660 : 600;+ const cardLeft = (refW - cardWidth) / 2;+ const cardTop = isVertical ? 140 : 70;+ const coverHeight = isVertical ? 180 : 150;+ const avatarSize = isVertical ? 120 : 110;++ const bounce = cardBounceIn(frame * speed, fps);+ const schedule = blurInSchedule();++ const layout = BUTTON_LAYOUT[orientation];+ const buttonCenter = {+ x: layout.x + layout.w / 2,+ y: layout.y + layout.h / 2,+ };++ const cursorStyle = useCursorPath(+ buildFollowWaypoints({ buttonCenter, orientation }),+ { speed },+ );+ const pressScale = 0.9 + 0.1 * (cursorStyle.pressScale ?? 1);++ const messageLayout = {+ x: layout.x - layout.h - 8,+ y: layout.y,+ size: layout.h,+ };++ const groupStyle = (group: number) => {+ const step = schedule[group];+ const b = blurInAt(step, frame * speed);+ return {+ filter: b.blur > 0 ? `blur(${b.blur}px)` : "none",+ opacity: b.opacity,+ transform: `translateY(${b.translateY}px)`,+ };+ };++ const pageBg = background === "transparent" ? "transparent" : t.page;++ 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",+ left: cardLeft,+ top: cardTop,+ width: cardWidth,+ background: t.cardBg,+ border: `1px solid ${t.cardBorder}`,+ borderRadius: 24,+ overflow: "hidden",+ transform: `translateY(${bounce.translateY}px) scale(${bounce.scale})`,+ transformOrigin: "center top",+ boxShadow:+ theme === "light"+ ? "0 12px 40px -16px rgba(15,20,25,0.18)"+ : "0 12px 40px -16px rgba(0,0,0,0.6)",+ }}+ >+ <div style={groupStyle(0)}>+ <Cover+ coverUrl={coverUrl}+ accent={accentColor}+ height={coverHeight}+ />+ </div>++ <div style={{ padding: "0 24px 24px" }}>+ <div+ style={{+ display: "flex",+ justifyContent: "space-between",+ alignItems: "flex-end",+ marginTop: -(avatarSize / 2),+ position: "relative",+ }}+ >+ <div+ style={{+ width: avatarSize,+ height: avatarSize,+ borderRadius: "100%",+ background: t.cardBg,+ flexShrink: 0,+ }}+ >+ <div style={groupStyle(1)}>+ <Avatar+ avatarUrl={avatarUrl}+ name={name}+ size={avatarSize}+ accent={accentColor}+ theme={t}+ />+ </div>+ </div>+ </div>++ <ProfileInfo+ name={name}+ handle={handle}+ bio={bio}+ verified={verified}+ accent={accentColor}+ theme={t}+ isVertical={isVertical}+ nameStyle={groupStyle(2)}+ handleStyle={groupStyle(3)}+ bioStyle={groupStyle(4)}+ />++ <div style={groupStyle(5)}>+ <MetaRow+ location={location}+ website={website}+ joined={joined}+ accent={accentColor}+ theme={t}+ />+ </div>++ <div style={{ height: layout.h - 8 }} aria-hidden="true" />++ <div style={groupStyle(7)}>+ <Tabs accent={accentColor} theme={t} isVertical={isVertical} />+ </div>++ <div style={groupStyle(8)}>+ <SamplePost+ name={name}+ handle={handle}+ avatarUrl={avatarUrl}+ accent={accentColor}+ theme={t}+ />+ </div>+ </div>+ </div>++ <div+ style={{+ position: "absolute",+ inset: 0,+ transform: `translateY(${bounce.translateY}px) scale(${bounce.scale})`,+ transformOrigin: "center top",+ }}+ >+ <div style={{ ...groupStyle(6), position: "absolute", inset: 0 }}>+ <MessageButton layout={messageLayout} theme={t} />+ <FollowButton+ frame={frame}+ speed={speed}+ accent={accentColor}+ theme={t}+ layout={layout}+ pressScale={pressScale}+ />+ </div>+ </div>++ <CursorLayer theme={theme} accent={accentColor} style={cursorStyle} />+ </div>+ </AbsoluteFill>+ );+}