BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fancy/random-letter-swap-pingpong-anim

Random Letter Swap Pingpong Anim

fancy/random-letter-swap-pingpong-anim
FreeComponent

A ui component.

Install it

npx shadcn@latest add https://www.fancycomponents.dev/r/random-letter-swap-pingpong-anim.json

Source

fancy/text/random-letter-swap-pingpong-anim.tsxwww.fancycomponents.dev/r/random-letter-swap-pingpong-anim.json
1"use client"
2
3import { useState } from "react"
4import { debounce } from "lodash"
5import { AnimationOptions, motion, useAnimate } from "motion/react"
6
7interface TextProps {
8 label: string
9 reverse?: boolean
10 transition?: AnimationOptions
11 staggerDuration?: number
12 className?: string
13 onClick?: () => void
14}
15
16const RandomLetterSwapPingPong = ({
17 label,
18 reverse = true,
19 transition = {
20 type: "spring",
21 duration: 0.8,
22 },
23 staggerDuration = 0.02,
24 className,
25 onClick,
26 ...props
27}: TextProps) => {
28 const [scope, animate] = useAnimate()
29 const [blocked, setBlocked] = useState(false)
30
31 const mergeTransition = (transition: AnimationOptions, i: number) => ({
32 ...transition,
33 delay: i * staggerDuration,
34 })
35
36 const shuffledIndices = Array.from(
37 { length: label.length },
38 (_, i) => i
39 ).sort(() => Math.random() - 0.5)
40
41 const hoverStart = debounce(
42 () => {
43 if (blocked) return
44 setBlocked(true)
45
46 for (let i = 0; i < label.length; i++) {
47 const randomIndex = shuffledIndices[i]
48 animate(
49 ".letter-" + randomIndex,
50 {
51 y: reverse ? "100%" : "-100%",
52 },
53 mergeTransition(transition, i)
54 )
55
56 animate(
57 ".letter-secondary-" + randomIndex,
58 {
59 top: "0%",
60 },
61 mergeTransition(transition, i)
62 )
63 }
64 },
65 100,
66 { leading: true, trailing: true }
67 )
68
69 const hoverEnd = debounce(
70 () => {
71 setBlocked(false)
72
73 for (let i = 0; i < label.length; i++) {
74 const randomIndex = shuffledIndices[i]
75 animate(
76 ".letter-" + randomIndex,
77 {
78 y: 0,
79 },
80 mergeTransition(transition, i)
81 )
82
83 animate(
84 ".letter-secondary-" + randomIndex,
85 {
86 top: reverse ? "-100%" : "100%",
87 },
88 mergeTransition(transition, i)
89 )
90 }
91 },
92 100,
93 { leading: true, trailing: true }
94 )
95
96 return (
97 <motion.span
98 className={`flex justify-center items-center relative overflow-hidden ${className} `}
99 onHoverStart={hoverStart}
100 onHoverEnd={hoverEnd}
101 onClick={onClick}
102 ref={scope}
103 {...props}
104 >
105 <span className="sr-only">{label}</span>
106
107 {label.split("").map((letter: string, i: number) => {
108 return (
109 <span
110 className="whitespace-pre relative flex"
111 key={i}
112 aria-hidden={true}
113// … truncated

What it pulls in

npm packages

  • lodash
  • motion

Files it writes

  • fancy/text/random-letter-swap-pingpong-anim

Facts

Registry
fancy
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-12
Last confirmed
today

Go to the source

www.fancycomponents.dev danielpetho/fancy on GitHub Raw registry item This item as JSON

More from fancy

All 158 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Animated Gradient With Svganimated-gradient-with-svgfancyComponentsFreeno deps
Basic Number Tickerbasic-number-tickerfancyComponentsFree1 dep
Box Carouselbox-carouselfancyComponentsFree1 dep
Breathing Textbreathing-textfancyComponentsFree1 dep
Circling Elementscircling-elementsfancyComponentsFree1 dep
Css Boxcss-boxfancyComponentsFree1 dep
Cursor Attractor And Gravitycursor-attractor-and-gravityfancyComponentsFree5 deps
Drag Elementsdrag-elementsfancyComponentsFree1 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

ToolDrift

What the AI coding tools changed last night

tooldrift.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 ToolDrift

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 ToolDrift

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 ToolDrift

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