Answer Stream
snap-cn/answer-streamFreeComponent
The beat after send: a macro shot on the button that cuts — hard, on its fastest frame — to the answer building itself on the page, while the camera pulls back 1.364× about a focal point above the frame to keep up with it. Every word arrives hot and cools to the foreground.
Install it
npx shadcn@latest add https://snapcn.dev/r/answer-stream.jsonSource
1"use client";23import { loadFont as loadSans } from "@remotion/google-fonts/Inter";4import { loadFont as loadSerif } from "@remotion/google-fonts/SourceSerif4";5import {6 AbsoluteFill,7 getRemotionEnvironment,8 useCurrentFrame,9 useVideoConfig,10} from "remotion";11import { inputStyleContext } from "@/components/snap-cn/input";12import {13 clamp01,14 easings,15 mixOklch,16 type SnapCnTheme,17 useSnapCnTheme,18} from "@/lib/snap-cn-ui";1920// Loaded through @remotion/google-fonts, never a CSS variable — a Remotion21// bundle has none of the app's CSS, so a `var(--font-…)` gets you the right face22// in the Player and a fallback in the mp4 (design-system rule 4).23const { fontFamily: SERIF } = loadSerif("normal", {24 weights: ["400", "600"],25 subsets: ["latin"],26});27const { fontFamily: SANS } = loadSans("normal", {28 weights: ["400", "500"],29 subsets: ["latin"],30});3132export interface AnswerCard {33 title: string;34 body: string;35 /** SVG path for the card's lead glyph, on a 24×24 viewBox. */36 icon?: string;37}3839export interface AnswerStreamProps {40 /** The prompt. Fills the pill, and stays in the composer. */41 question?: string;42 /** The reply. `\n` is a hard break; everything else wraps. */43 answer?: string;44 /** The line that lands under the reply and introduces the cards. */45 headline?: string;46 /** The plan. Each lands as an empty card, then fills. */47 cards?: AnswerCard[];48 /** Composer footer. */49 model?: string;5051 // --- timeline (seconds) ---52 /** When the push into the send button starts accelerating. */53 commitAt?: number;54 /** When the shot **cuts** to the answer. Not a transition — one frame. */55 cutAt?: number;56 /** When the camera starts pulling back to keep up with the answer. */57 pullbackAt?: number;58 /** How long the pull-back takes. */59 pullbackDuration?: number;60 /** Streaming rate, in words per second. */61 wordsPerSecond?: number;62 /** How long a word stays hot before it has cooled to `foreground`. */63 coolSeconds?: number;6465 // --- camera ---66 /** Scale of the opening macro shot on the send button. */67 macroZoom?: number;68 /** How far in the answer shot starts, relative to where it settles. */69 pullbackFrom?: number;70 /** How far past its mark the pull-back goes before easing back onto it. */71 pullbackUndershoot?: number;72 /** The pull-back's focal point, as a fraction of the frame. It is *above*73 * the top edge, which is what makes the page rise as it shrinks. */74 focusX?: number;75// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from snap-cn
All 24 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| UI Caretcaret | snap-cn | Components | Free | 1 dep | |
| Follower Rushfollower-rush | snap-cn | Components | Free | 2 deps | |
| Product Herohero-launch | snap-cn | Components | Free | 2 deps | |
| UI Inputinput | snap-cn | Components | Free | 2 deps · 2 files | |
| Karaoke Captionskaraoke-captions | snap-cn | Components | Free | 2 deps | |
| Laptop Framelaptop-frame | snap-cn | Components | Free | 1 dep | |
| Logo Assemblelogo-assemble | snap-cn | Components | Free | 1 dep | |
| Logo Flickerlogo-flicker | snap-cn | Components | Free | 1 dep |
