Updated
Zoom Past
Come closer
Customize
Duration0.50s
Exit scale2.6
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/zoom-past.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/zoom-past/zoom-past.tsx"use client"; import { cn } from "@/lib/utils"; import { AnimatePresence, motion } from "motion/react"; // `play` counts presses of a card's Change button. 0 means the card has not // been pressed yet, so every effect renders its resting state without // animating on page load. export type EffectProps = { play: number }; // Size comes from --text-effect-size (default 1.25rem, i.e. text-xl), so a // preview can enlarge every effect without changing the installed default. const SIZE = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4]"; const TEXT = `${SIZE} text-zinc-700 font-medium dark:text-zinc-200`; const EASE_OUT = [0.23, 1, 0.32, 1] as const; // The entry for the nth press, wrapping around the list. const pick = <T,>(list: T[], play: number) => list[((play % list.length) + list.length) % list.length]; // 23 — The current word rushes past the viewer and fades, while the next one // travels forward from far behind. Both share one grid cell, so they overlap // without absolute positioning.
Adds the files to
components/uibrik/zoom-past and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/zoom-past.Usage
import { ZoomPast } from "@/components/uibrik/zoom-past/zoom-past";<ZoomPast play={0} words={["Come closer", "Even closer", "Right here"]} duration={0.5} exitScale={2.6}/>Where to use Zoom Past
High-energy headlines
Words flying toward you with the next arriving behind create momentum.
Event and launch pages
Zooming text suits countdowns and big reveals.
Video-style intros
A cinematic word sequence works as an intro without video.
Props
ZoomPast- words
- Type string[]
- ["Come closer","Even closer","Right here"]
- Cycled through, one per play.
- duration
- Type number
- 0.5
- Time for one word to pass.
- exitScale
- Type number
- 2.6
- How large the old word grows as it rushes past.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.