{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"follower-rush","type":"registry:component","title":"Follower Rush","description":"Follower count animation: X/Twitter follower notification with a count-up and avatar wave, for social proof. An X-style follower notification that piles up — avatars stack in and the count explodes, then the row bends into an undulating wave of faces.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/follower-rush.tsx","type":"registry:component","target":"components/kuchi/follower-rush.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Inter\";\r\nimport { useState } from \"react\";\r\nimport {\r\n  AbsoluteFill,\r\n  getRemotionEnvironment,\r\n  Img,\r\n  interpolate,\r\n  staticFile,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport {\r\n  Item,\r\n  parseColor,\r\n  resolveFont,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\nconst { fontFamily: FONT_FAMILY } = loadSans(\"normal\", {\r\n  weights: [\"400\", \"500\", \"700\", \"800\"],\r\n  subsets: [\"latin\"],\r\n});\r\n\r\nexport interface Follower {\r\n  name: string;\r\n  /**\r\n   * Square photo for this follower. Root-relative paths (`/avatars/ada.jpg`) are\r\n   * served by the app in the browser and rewritten through `staticFile()` in a\r\n   * render; absolute URLs are passed straight through.\r\n   *\r\n   * Omit it and the avatar falls back to the gradient monogram, which is what\r\n   * makes the fallback worth having: a crowd is the one place a missing photo\r\n   * shows up as a hole in the row.\r\n   */\r\n  avatar?: string;\r\n}\r\n\r\nexport interface FollowerRushProps {\r\n  totalFollowers?: number;\r\n  followers?: Follower[];\r\n  /** Overrides the design system's `primary`. */\r\n  accentColor?: string;\r\n  /** Design-system token overrides. */\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  /**\r\n   * The face this scene paints its words in — a label from `fonts.ts`\r\n   * (\"Inter\", \"Space Grotesk\", \"Instrument Serif\") or a CSS family you have\r\n   * loaded yourself. Unset, the scene keeps the face it was designed around.\r\n   *\r\n   * Overrides `theme.fontFamily`, which is how a brand kit re-skins a whole\r\n   * timeline from one value.\r\n   */\r\n  fontFamily?: string;\r\n  orientation?: \"horizontal\" | \"vertical\";\r\n  speed?: number;\r\n}\r\n\r\ninterface Theme {\r\n  bg: string;\r\n  fg: string;\r\n  fgMuted: string;\r\n  /** Placeholder disc behind a photo — `muted`, one step off the page. */\r\n  avatarBg: string;\r\n}\r\n\r\n// The four surfaces this scene paints, taken from the design system rather\r\n// than mirrored as hex — so a user's own token overrides reach the pile-up\r\n// instead of stopping at a copy of the defaults.\r\nfunction paletteFrom(t: KuchiTheme): Theme {\r\n  return {\r\n    bg: t.card,\r\n    fg: t.foreground,\r\n    fgMuted: t.mutedForeground,\r\n    avatarBg: t.muted,\r\n  };\r\n}\r\n\r\n/**\r\n * How many photos the sample crowd cycles through.\r\n *\r\n * 24, because the wave holds 22 avatars and scrolls two spare slots past the\r\n * edge (`MAX + 2`), so 24 is the smallest set where no two faces are ever on\r\n * screen together. Fewer is fine — they just repeat sooner. More is wasted; only\r\n * 24 can ever be visible at once.\r\n */\r\nconst SAMPLE_AVATAR_COUNT = 24;\r\n\r\n/**\r\n * The crowd of names shown in the pile and named in the callout. Purely\r\n * flavour — swap it via the `followers` prop.\r\n *\r\n * Photos come from `public/avatars/01.jpg … 24.jpg`, kept local so the scene\r\n * still renders with no network and no CORS. **The files are the only thing this\r\n * expects — nothing here needs editing to add them.** Any that are missing fall\r\n * back to the gradient monogram rather than failing the render, which is also\r\n * what makes this list safe to ship before the folder is filled.\r\n *\r\n * There are more names than photos on purpose: the names cycle faster than the\r\n * faces, so a repeat of either never lines up with a repeat of the other.\r\n */\r\nexport const SAMPLE_FOLLOWERS: Follower[] = [\r\n  \"Manon\",\r\n  \"Melon\",\r\n  \"Victor\",\r\n  \"Shane\",\r\n  \"Lisa\",\r\n  \"Natasha\",\r\n  \"Annie\",\r\n  \"Abdull\",\r\n  \"Kratos\",\r\n  \"Jhone\",\r\n  \"Matt\",\r\n  \"Huggy\",\r\n  \"Felomi\",\r\n  \"Hazar\",\r\n  \"Mikasa\",\r\n  \"Silmon\",\r\n  \"Luciano\",\r\n  \"Nova\",\r\n  \"Priya\",\r\n  \"Theo\",\r\n  \"Amelia\",\r\n  \"Rafael\",\r\n  \"Sofia\",\r\n  \"Kai\",\r\n  \"Jordan\",\r\n  \"Nora\",\r\n  \"Dana\",\r\n  \"Milo\",\r\n  \"Yuki\",\r\n  \"Bruno\",\r\n  \"Elena\",\r\n  \"Omar\",\r\n  \"Ivy\",\r\n  \"Leo\",\r\n  \"Zara\",\r\n  \"Finn\",\r\n  \"Maya\",\r\n  \"Cole\",\r\n].map((name, i) => ({\r\n  name,\r\n  // Slice, not `padStart` (ES2017) — a stock Remotion project types ES2015.\r\n  avatar: `https://kuchi-media.kalarislabs.com/components/art/avatar-${`0${(i % SAMPLE_AVATAR_COUNT) + 1}`.slice(-2)}.svg`,\r\n}));\r\n\r\n// --- Pure helpers (unit-tested) -------------------------------------------\r\n\r\nexport function clamp01(x: number): number {\r\n  return Math.max(0, Math.min(1, x));\r\n}\r\n\r\nexport function smoothstep(x: number): number {\r\n  const c = clamp01(x);\r\n  return c * c * (3 - 2 * c);\r\n}\r\n\r\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\r\n\r\n/**\r\n * The running follower total at effective frame `fc`. Holds at 1 through the\r\n * inline intro; then grows *linearly* to a full pile (`midCount`) by `midF`;\r\n * then *explodes exponentially* to `target`, landing on it at `endF`. This is\r\n * the reference's shape — a believable trickle, then a blow-up. Rounded and\r\n * clamped to `[1, target]`.\r\n */\r\nexport function followerCount(\r\n  fc: number,\r\n  target: number,\r\n  startF: number,\r\n  midF: number,\r\n  endF: number,\r\n  midCount: number,\r\n): number {\r\n  if (fc <= startF) return 1;\r\n  if (fc <= midF) {\r\n    const p = (fc - startF) / (midF - startF);\r\n    return Math.min(target, Math.max(1, Math.round(1 + p * (midCount - 1))));\r\n  }\r\n  const p = clamp01((fc - midF) / (endF - midF));\r\n  const c = midCount * (target / midCount) ** p;\r\n  return Math.min(target, Math.round(c));\r\n}\r\n\r\n/**\r\n * How far the crowd has scrolled, in stage px, at effective frame `fc`.\r\n *\r\n * The counter explodes from a full pile to the target between `growEnd` and\r\n * `explodeEnd`, so the crowd accelerates across exactly that window and then\r\n * holds. It used to travel at a flat 0.85px/frame, which is one avatar slot for\r\n * the whole blow-up — the number ran to five thousand while a single face went\r\n * past, and the wave read as still.\r\n *\r\n * Velocity ramps linearly `v0 → vMax` over the window, so position is its\r\n * integral: quadratic while it accelerates, linear once it holds. Velocity is\r\n * continuous at the join, which is what stops the hand-off being visible — a\r\n * speed that steps is a jolt no easing curve can hide afterwards.\r\n */\r\nexport function waveScroll(\r\n  fc: number,\r\n  growEnd: number,\r\n  explodeEnd: number,\r\n  v0: number,\r\n  vMax: number,\r\n): number {\r\n  const f = Math.max(0, fc - growEnd);\r\n  const T = explodeEnd - growEnd;\r\n  if (T <= 0) return f * vMax;\r\n  if (f <= T) return v0 * f + ((vMax - v0) * f * f) / (2 * T);\r\n  // Distance banked over the ramp, then flat out.\r\n  return (T * (v0 + vMax)) / 2 + vMax * (f - T);\r\n}\r\n\r\n// --- Sub-components --------------------------------------------------------\r\n\r\n/** The X verified seal — the shape is the reference's, the fill is the theme\r\n *  accent (design-system rule: take the shape, leave the brand's paint). */\r\nfunction VerifiedBadge({ accent, size }: { accent: string; size: number }) {\r\n  return (\r\n    <svg\r\n      xmlns=\"http://www.w3.org/2000/svg\"\r\n      viewBox=\"0 0 22 22\"\r\n      width={size}\r\n      height={size}\r\n      fill={accent}\r\n      style={{ flexShrink: 0, display: \"block\" }}\r\n    >\r\n      <title>Verified</title>\r\n      <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\" />\r\n    </svg>\r\n  );\r\n}\r\n\r\n/** The \"new follower\" silhouette that leads the pile before the wave takes over. */\r\nfunction PersonIcon({ color, size }: { color: string; size: number }) {\r\n  return (\r\n    <svg\r\n      xmlns=\"http://www.w3.org/2000/svg\"\r\n      viewBox=\"0 0 24 24\"\r\n      width={size}\r\n      height={size}\r\n      fill={color}\r\n      style={{ display: \"block\" }}\r\n    >\r\n      <title>New follower</title>\r\n      <circle cx=\"12\" cy=\"7.2\" r=\"4\" />\r\n      <path d=\"M12 13.4c-4.05 0-7.2 2.3-7.2 5.6 0 .55.45 1 1 1h12.4c.55 0 1-.45 1-1 0-3.3-3.15-5.6-7.2-5.6z\" />\r\n    </svg>\r\n  );\r\n}\r\n\r\n/** Rewrite root-relative assets through staticFile everywhere but the Player. */\r\nfunction resolveSrc(src: string): string {\r\n  const isLocal = src.startsWith(\"/\") && !src.startsWith(\"//\");\r\n  if (!isLocal || getRemotionEnvironment().isPlayer) return src;\r\n  // A value that already came out of staticFile() carries the static base\r\n  // (`/static-<hash>/…`); running it through again would prefix it twice.\r\n  const base = staticFile(\"_\").slice(0, -2);\r\n  if (base && src.startsWith(`${base}/`)) return src;\r\n  try {\r\n    return staticFile(src.replace(/^\\/+/, \"\"));\r\n  } catch {\r\n    return src;\r\n  }\r\n}\r\n\r\n/**\r\n * A follower's photo, over a neutral monogram disc for when there isn't one.\r\n *\r\n * The disc used to be a hue derived from the name, which gave the crowd a row of\r\n * saturated greens and magentas — a palette invented right here, which the\r\n * design-system rule exists to forbid, and which fought every real photograph\r\n * put next to it. It is `muted` now: one step off the page, no hue of its own.\r\n *\r\n * It stays *underneath* the photo rather than being swapped out for it, so a\r\n * photo still decoding shows a filled disc instead of a hole in the row.\r\n * Remotion's `<Img>` holds a render back until it has loaded so a rendered frame\r\n * never catches that state, but the live `<Player>` and the customizer have no\r\n * such guarantee, and a row of empty circles reads as broken.\r\n */\r\nfunction Avatar({\r\n  follower,\r\n  size,\r\n  ring,\r\n  theme,\r\n  face,\r\n}: {\r\n  follower: Follower;\r\n  size: number;\r\n  ring: number;\r\n  theme: Theme;\r\n  face: string;\r\n}) {\r\n  const [failedSrc, setFailedSrc] = useState<string | null>(null);\r\n  return (\r\n    <div\r\n      style={{\r\n        position: \"relative\",\r\n        width: size,\r\n        height: size,\r\n        borderRadius: 9999,\r\n        background: theme.avatarBg,\r\n        // Ring in the page colour, drawn as box-shadow so it doesn't grow the\r\n        // layout box — the overlap pitch stays exact.\r\n        boxShadow: `0 0 0 ${ring}px ${theme.bg}`,\r\n        display: \"flex\",\r\n        alignItems: \"center\",\r\n        justifyContent: \"center\",\r\n        color: theme.fgMuted,\r\n        fontFamily: face,\r\n        fontWeight: 700,\r\n        fontSize: size * 0.4,\r\n        overflow: \"hidden\",\r\n        flexShrink: 0,\r\n      }}\r\n    >\r\n      {follower.name.charAt(0).toUpperCase()}\r\n      {follower.avatar && failedSrc !== follower.avatar && (\r\n        <Img\r\n          src={resolveSrc(follower.avatar)}\r\n          // Without a handler Remotion treats a 404 as fatal and kills the whole\r\n          // render. One follower with a dead photo URL is not a reason to lose the\r\n          // video — drop back to the monogram already painted underneath.\r\n          //\r\n          // Keyed by src, not a bare boolean: a slot keeps its React instance\r\n          // while the crowd scrolls a *different* follower through it, so a plain\r\n          // `failed` flag would condemn every later face to the same slot.\r\n          onError={() => setFailedSrc(follower.avatar ?? null)}\r\n          // `cover` on a square box: a portrait crops to its centre rather than\r\n          // letterboxing, which is the one thing a circular avatar cannot do.\r\n          style={{\r\n            position: \"absolute\",\r\n            inset: 0,\r\n            width: \"100%\",\r\n            height: \"100%\",\r\n            objectFit: \"cover\",\r\n            borderRadius: 9999,\r\n            // Preflight's `img { max-width: 100% }` is harmless here because the\r\n            // box is explicitly sized, but say it anyway — this component ships\r\n            // into other people's stylesheets.\r\n            maxWidth: \"none\",\r\n          }}\r\n        />\r\n      )}\r\n    </div>\r\n  );\r\n}\r\n\r\n/** The bold-name + badge + \"…followed you\" callout under the pile. */\r\nfunction FollowLine({\r\n  name,\r\n  others,\r\n  fontSize,\r\n  theme,\r\n  accent,\r\n  face,\r\n}: {\r\n  name: string;\r\n  others: number;\r\n  fontSize: number;\r\n  theme: Theme;\r\n  accent: string;\r\n  face: string;\r\n}) {\r\n  return (\r\n    <div\r\n      style={{\r\n        display: \"inline-flex\",\r\n        alignItems: \"center\",\r\n        gap: fontSize * 0.24,\r\n        whiteSpace: \"nowrap\",\r\n        fontFamily: face,\r\n        fontSize,\r\n        lineHeight: 1,\r\n      }}\r\n    >\r\n      <span\r\n        style={{ fontWeight: 800, color: theme.fg, letterSpacing: \"-0.01em\" }}\r\n      >\r\n        {name}\r\n      </span>\r\n      <VerifiedBadge accent={accent} size={fontSize * 0.62} />\r\n      <span style={{ fontWeight: 500, color: theme.fgMuted }}>\r\n        {others <= 0\r\n          ? \"followed you\"\r\n          : `and ${others.toLocaleString(\"en-US\")} others followed you`}\r\n      </span>\r\n    </div>\r\n  );\r\n}\r\n\r\n// --- Main composition ------------------------------------------------------\r\n\r\nexport function FollowerRush({\r\n  totalFollowers = 5000,\r\n  followers = SAMPLE_FOLLOWERS,\r\n  accentColor,\r\n  theme,\r\n  mode,\r\n  fontFamily,\r\n  orientation = \"horizontal\",\r\n  speed = 1,\r\n}: FollowerRushProps) {\r\n  const frame = useCurrentFrame();\r\n  const { width, height } = useVideoConfig();\r\n  const tokens = useKuchiTheme(theme, mode);\r\n  const face = resolveFont(fontFamily ?? tokens.fontFamily) ?? FONT_FAMILY;\r\n  const t = paletteFrom(tokens);\r\n  // A transparent page asks for no page. The scene paints the card surface, so\r\n  // it is dropped here rather than through the token; the rings keep it.\r\n  const bare = parseColor(tokens.background).alpha === 0;\r\n  const accent = accentColor ?? tokens.primary;\r\n  const pool = followers.length > 0 ? followers : SAMPLE_FOLLOWERS;\r\n  const isVertical = orientation === \"vertical\";\r\n\r\n  const refW = isVertical ? 720 : 1280;\r\n  const refH = isVertical ? 1280 : 720;\r\n  const stageScale = Math.min(width / refW, height / refH);\r\n  const fc = frame * speed;\r\n\r\n  // --- timeline (effective frames, fps 30) ---\r\n  const APPEAR = 8;\r\n  const INLINE_END = 20; // single \"X followed you\" notification holds until here\r\n  const MORPH_END = 34; // …then lifts into the stacked pile\r\n  // The pile used to spend 116 frames (3.9s) laying down 21 avatars and the\r\n  // count did not start climbing in earnest until frame 150 — half the clip gone\r\n  // before anything felt urgent, which is what read as the numbers being slow.\r\n  // They were not slower; they started later. 50 frames to fill, and the blow-up\r\n  // begins at 1.8s instead of 5s.\r\n  const GROW_END = 84; // pile fills to MAX; wave + scroll begin\r\n  const EXPLODE_END = 140; // count lands on the target; row has fully bent to a wave\r\n\r\n  const MAX = 22; // most avatars ever shown at once\r\n\r\n  // `totalFollowers` is the headline \"others\" number, so the running total that\r\n  // drives the pile is one more (the lead + the others).\r\n  const others = Math.max(0, Math.round(totalFollowers));\r\n  const target = others + 1;\r\n  const count = followerCount(\r\n    fc,\r\n    target,\r\n    INLINE_END,\r\n    GROW_END,\r\n    EXPLODE_END,\r\n    MAX,\r\n  );\r\n  const shownOthers = count - 1;\r\n\r\n  // --- layout constants (reference stage px) ---\r\n  const D = isVertical ? 60 : 66; // avatar diameter\r\n  const ring = isVertical ? 3 : 4;\r\n  const pilePitch = D * 0.76; // overlap in the flat pile\r\n  const iconSize = D * 0.92;\r\n  const iconGap = D * 0.24;\r\n  const rowY = isVertical ? refH * 0.4 : 316; // avatar row centre (stacked)\r\n  const textY = isVertical ? refH * 0.52 : 452; // follow-line centre (stacked)\r\n  const inlineY = refH / 2;\r\n  const fontSize = isVertical ? 40 : 48;\r\n\r\n  // --- phase progresses ---\r\n  const globalFade = interpolate(fc, [0, APPEAR], [0, 1], {\r\n    extrapolateLeft: \"clamp\",\r\n    extrapolateRight: \"clamp\",\r\n  });\r\n  const stackP = smoothstep((fc - INLINE_END) / (MORPH_END - INLINE_END));\r\n  // The inline notification clears first; the stacked callout appears after, so\r\n  // the two \"…followed you\" lines never overlap during the morph.\r\n  const inlineOut = smoothstep((fc - INLINE_END) / 7);\r\n  const textIn = smoothstep((fc - (INLINE_END + 7)) / (MORPH_END - INLINE_END));\r\n  const sp = smoothstep((fc - GROW_END) / (EXPLODE_END - GROW_END)); // flat→wave\r\n  const iconOpacity = interpolate(fc, [GROW_END - 6, GROW_END + 36], [1, 0], {\r\n    extrapolateLeft: \"clamp\",\r\n    extrapolateRight: \"clamp\",\r\n  });\r\n\r\n  // Lead (bold) name cycles ~2.3×/s while followers rush in, then freezes on the\r\n  // last one so the held wave doesn't flicker names forever.\r\n  const NAME_SLOT = 9;\r\n  const nameFreeze = Math.floor((EXPLODE_END - INLINE_END) / NAME_SLOT);\r\n  const nameIdx =\r\n    fc < INLINE_END\r\n      ? 0\r\n      : Math.min(Math.floor((fc - INLINE_END) / NAME_SLOT), nameFreeze);\r\n  const leadName = pool[nameIdx % pool.length].name;\r\n\r\n  // --- wave / pile geometry ---\r\n  const waveMargin = isVertical ? 44 : 74;\r\n  const waveLeft = waveMargin;\r\n  const waveSpan = refW - waveMargin * 2;\r\n  const waveP = waveSpan / (MAX - 1);\r\n  const waveAmp = (isVertical ? 40 : 46) * sp;\r\n  const WAVE_FREQ = 1.55; // periods across the strip\r\n  const wavePhase = fc * 0.05; // the wave travels\r\n  // Left alone deliberately: the crowd rushing *through* a slow-moving sine is\r\n  // what makes them surf it. Speed the field up with them and the two motions\r\n  // cancel — the avatars would slide sideways along a wave that no longer\r\n  // appears to lift them.\r\n  //\r\n  // ~22px/frame flat out is one avatar slot every ~2.5 frames (the wave pitch is\r\n  // ~54px here), so about twelve faces a second stream past at the peak.\r\n  //\r\n  // This is near the ceiling for a 30fps composition: at 22px the crowd moves a\r\n  // third of an avatar's diameter per frame, and much past that the row stops\r\n  // reading as travelling and starts reading as strobing — discrete copies\r\n  // rather than motion. Faster than this wants motion blur, not a bigger number.\r\n  const scrollPx = waveScroll(\r\n    fc,\r\n    GROW_END,\r\n    EXPLODE_END,\r\n    isVertical ? 0.6 : 0.85,\r\n    isVertical ? 15 : 22,\r\n  );\r\n  const scrollUnit = Math.floor(scrollPx / waveP);\r\n\r\n  // Flat pile: icon + avatars, centred as one group. Width grows smoothly with\r\n  // the (un-rounded) count so adding an avatar doesn't jolt the centring.\r\n  const pileCountF = Math.min(\r\n    MAX,\r\n    fc <= INLINE_END\r\n      ? 1\r\n      : fc <= GROW_END\r\n        ? 1 + ((fc - INLINE_END) / (GROW_END - INLINE_END)) * (MAX - 1)\r\n        : MAX,\r\n  );\r\n  const pileW = (pileCountF - 1) * pilePitch + D;\r\n  const groupW = iconSize + iconGap + pileW;\r\n  const groupLeft = (refW - groupW) / 2;\r\n  const pileStartCX = groupLeft + iconSize + iconGap + D / 2;\r\n  const iconCX = groupLeft + iconSize / 2;\r\n\r\n  const isRendering = getRemotionEnvironment().isRendering;\r\n  const willChange = isRendering ? undefined : (\"transform\" as const);\r\n\r\n  const SLOTS = MAX + 2; // two extra so the scroll never opens an edge gap\r\n\r\n  return (\r\n    <AbsoluteFill style={{ background: bare ? \"transparent\" : t.bg }}>\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          left: \"50%\",\r\n          top: \"50%\",\r\n          width: refW,\r\n          height: refH,\r\n          transform: `translate(-50%, -50%) scale(${stageScale})`,\r\n          opacity: globalFade,\r\n        }}\r\n      >\r\n        {/* ---- Inline first notification: [icon][avatar] Name ✓ followed you.\r\n             Fades up and out as the pile takes over. */}\r\n        {inlineOut < 1 && (\r\n          <div\r\n            style={{\r\n              position: \"absolute\",\r\n              inset: 0,\r\n              display: \"flex\",\r\n              alignItems: \"center\",\r\n              justifyContent: \"center\",\r\n              gap: iconGap,\r\n              opacity: 1 - inlineOut,\r\n              transform: `translateY(${lerp(0, -18, inlineOut)}px)`,\r\n              willChange,\r\n            }}\r\n          >\r\n            <PersonIcon color={accent} size={iconSize} />\r\n            <Avatar\r\n              follower={pool[0]}\r\n              size={D}\r\n              ring={ring}\r\n              theme={t}\r\n              face={face}\r\n            />\r\n            <div style={{ marginLeft: iconGap * 0.6 }}>\r\n              <FollowLine\r\n                face={face}\r\n                name={pool[0].name}\r\n                others={0}\r\n                fontSize={fontSize}\r\n                theme={t}\r\n                accent={accent}\r\n              />\r\n            </div>\r\n          </div>\r\n        )}\r\n\r\n        {/* ---- Person icon leading the flat pile (fades out as the wave forms) */}\r\n        {iconOpacity > 0 && sp < 1 && (\r\n          <div\r\n            style={{\r\n              position: \"absolute\",\r\n              left: iconCX,\r\n              top: lerp(inlineY, rowY, stackP),\r\n              transform: `translate(-50%, -50%) scale(${1 - sp})`,\r\n              opacity: iconOpacity * stackP,\r\n            }}\r\n          >\r\n            <PersonIcon color={accent} size={iconSize} />\r\n          </div>\r\n        )}\r\n\r\n        {/* ---- The avatar crowd: a flat overlapping pile that bends into a\r\n             travelling wave. A single edge mask fades the wave's ends; the\r\n             centred pile never reaches the edges, so it is untouched. */}\r\n        <div\r\n          style={{\r\n            position: \"absolute\",\r\n            inset: 0,\r\n            opacity: stackP,\r\n            WebkitMaskImage: `linear-gradient(to right, transparent 0%, #000 ${(waveMargin / refW) * 100 + 1}%, #000 ${100 - (waveMargin / refW) * 100 - 1}%, transparent 100%)`,\r\n            maskImage: `linear-gradient(to right, transparent 0%, #000 ${(waveMargin / refW) * 100 + 1}%, #000 ${100 - (waveMargin / refW) * 100 - 1}%, transparent 100%)`,\r\n          }}\r\n        >\r\n          {Array.from({ length: SLOTS }, (_, i) => {\r\n            const follower = pool[(i + scrollUnit) % pool.length];\r\n            // pile position (flat, centred) → wave position (full width, sine)\r\n            const pileCX = pileStartCX + i * pilePitch;\r\n            const waveCX = waveLeft + i * waveP - (scrollPx % waveP);\r\n            const cx = lerp(pileCX, waveCX, sp);\r\n            const pileCY = lerp(inlineY, rowY, stackP);\r\n            const waveCY =\r\n              rowY +\r\n              waveAmp *\r\n                Math.sin((cx / refW) * Math.PI * 2 * WAVE_FREQ + wavePhase);\r\n            const cy = lerp(pileCY, waveCY, sp);\r\n\r\n            // pile avatars pop in as the count reaches them; the two extra\r\n            // scroll slots only exist once the wave is spread out.\r\n            const popIn = smoothstep(clamp01(count - i));\r\n            const baseOpacity = i < MAX ? popIn : 0;\r\n            const opacity = lerp(baseOpacity, 1, sp);\r\n            if (opacity <= 0.001) return null;\r\n            const popScale = lerp(0.55, 1, popIn);\r\n\r\n            // The follower is the object Studio selects, by its place in\r\n            // `followers`. A pool shorter than the row shows one twice; the\r\n            // first copy is the one outlined.\r\n            return (\r\n              <Item\r\n                // biome-ignore lint/suspicious/noArrayIndexKey: slots are positional; the follower shown in a slot changes as the crowd scrolls, so keying by follower would remount every frame.\r\n                key={i}\r\n                index={(i + scrollUnit) % pool.length}\r\n                primary={i < pool.length}\r\n              >\r\n                <div\r\n                  style={{\r\n                    position: \"absolute\",\r\n                    left: cx,\r\n                    top: cy,\r\n                    transform: `translate(-50%, -50%) scale(${lerp(popScale, 1, sp)})`,\r\n                    opacity,\r\n                    zIndex: SLOTS - i, // leftmost on top\r\n                    willChange,\r\n                  }}\r\n                >\r\n                  <Avatar\r\n                    follower={follower}\r\n                    size={D}\r\n                    ring={ring}\r\n                    theme={t}\r\n                    face={face}\r\n                  />\r\n                </div>\r\n              </Item>\r\n            );\r\n          })}\r\n        </div>\r\n\r\n        {/* ---- Follow-line callout (stacked), centred under the pile/wave. */}\r\n        <div\r\n          style={{\r\n            position: \"absolute\",\r\n            left: 0,\r\n            right: 0,\r\n            top: textY,\r\n            display: \"flex\",\r\n            justifyContent: \"center\",\r\n            transform: `translateY(-50%) translateY(${lerp(12, 0, textIn)}px)`,\r\n            opacity: textIn,\r\n            textRendering: \"geometricPrecision\",\r\n            willChange,\r\n          }}\r\n        >\r\n          <FollowLine\r\n            face={face}\r\n            name={leadName}\r\n            others={shownOthers}\r\n            fontSize={fontSize}\r\n            theme={t}\r\n            accent={accent}\r\n          />\r\n        </div>\r\n      </div>\r\n    </AbsoluteFill>\r\n  );\r\n}\r\n"}]}