BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/snap-cn/text-swap

Text Swap

snap-cn/text-swap
FreeComponent

Replaces one line of text with another using exit-then-enter scheduling, with five transition presets: fade-through, crossfade, shared-axis-y, shared-axis-z, and cut.

Install it

npx shadcn@latest add https://snapcn.dev/r/text-swap.json

Source

registry/snap-cn/text-swap/index.tsxsnapcn.dev/r/text-swap.json · first 6 KB
1"use client";
2
3import { Easing, interpolate, useCurrentFrame } from "remotion";
4import { type SnapCnTheme, useSnapCnTheme } from "@/lib/snap-cn-ui";
5
6export type TextSwapTransition =
7 | "fly-through"
8 | "fade-through"
9 | "crossfade"
10 | "shared-axis-y"
11 | "shared-axis-z"
12 | "cut";
13
14export type TextSwapUnit = "word" | "block";
15
16export interface TextSwapTransitionDefaults {
17 unit: TextSwapUnit;
18 exitDuration: number;
19 enterDuration: number;
20}
21
22/**
23 * Per-transition timing defaults. `unit` picks whether the line animates as a
24 * whole block or word-by-word when the `unit` prop is omitted.
25 */
26export const TRANSITION_DEFAULTS: Record<
27 TextSwapTransition,
28 TextSwapTransitionDefaults
29> = {
30 // Always a block: the line has to rush the camera as one object. Per-word it
31 // would be five objects each blowing up about its own centre, which is not a
32 // camera move, it is a collision.
33 "fly-through": { unit: "block", exitDuration: 20, enterDuration: 16 },
34 "fade-through": { unit: "block", exitDuration: 8, enterDuration: 13 },
35 crossfade: { unit: "word", exitDuration: 15, enterDuration: 21 },
36 "shared-axis-y": { unit: "block", exitDuration: 10, enterDuration: 14 },
37 "shared-axis-z": { unit: "block", exitDuration: 11, enterDuration: 16 },
38 cut: { unit: "word", exitDuration: 8, enterDuration: 8 },
39};
40
41export interface TextSwapMotion {
42 /** Y offset (px) the outgoing text drifts to. */
43 exitY: number;
44 /** Scale the outgoing text ends at. */
45 exitScale: number;
46 /** Blur (px) the outgoing text ends at. */
47 exitBlur: number;
48 /** Y offset (px) the incoming text starts from. */
49 enterY: number;
50 /** Scale the incoming text starts from. */
51 enterScale: number;
52 /** Blur (px) the incoming text starts from. */
53 enterBlur: number;
54
55 /**
56 * Shape the exit's scale as a **perspective rush** instead of a plain ramp —
57 * see `perspectiveScale`. Only worth it when the line is meant to pass the
58 * camera rather than merely grow.
59 */
60 exitPerspective?: boolean;
61 /**
62 * Fraction of the exit that passes before the outgoing line starts to fade.
63 * 0 (the default) fades across the whole exit. A line flying at your face does
64 * not dim on the way in — it stays solid until it is on top of you and then it
65 * is gone, so this holds the fade back until the very end.
66 */
67 exitFadeStart?: number;
68 /**
69 * Motion-blur samples for the exit. See `SHUTTER` below.
70 *
71// … truncated

What it pulls in

npm packages

  • remotion

Other registry items

  • https://snapcn.dev/r/snap-cn-ui.json

Files it writes

  • registry/snap-cn/text-swap/index.tsx

Facts

Registry
snap-cn
Type
registry:component
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

snapcn.dev Raw registry item This item as JSON

More from snap-cn

All 24 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Answer Streamanswer-streamsnap-cnComponentsFree2 deps
UI Caretcaretsnap-cnComponentsFree1 dep
Follower Rushfollower-rushsnap-cnComponentsFree2 deps
Product Herohero-launchsnap-cnComponentsFree2 deps
UI Inputinputsnap-cnComponentsFree2 deps · 2 files
Karaoke Captionskaraoke-captionssnap-cnComponentsFree2 deps
Laptop Framelaptop-framesnap-cnComponentsFree1 dep
Logo Assemblelogo-assemblesnap-cnComponentsFree1 dep

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex