BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/navdeep-singh/flexible-at-scale-illustration

Flexible at Scale Illustration

navdeep-singh/flexible-at-scale-illustration
FreeComponent

An interactive spring-based line field that responds to pointer movement.

Install it

npx shadcn@latest add https://ui.navdeepsingh.dev/r/flexible-at-scale-illustration.json

Source

components/illustrations/FlexibleAtScaleIllustration.tsxui.navdeepsingh.dev/r/flexible-at-scale-illustration.json
1'use client'
2
3import type { PointerEvent } from 'react'
4import {
5 motion,
6 useMotionValue,
7 useReducedMotion,
8 useSpring,
9 useTransform,
10 type MotionValue,
11} from 'motion/react'
12
13const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max)
14
15const FLEXIBLE_LINE_COUNT = 17
16
17const flexibleLines = Array.from({ length: FLEXIBLE_LINE_COUNT }, (_, index) => {
18 const progress = index / (FLEXIBLE_LINE_COUNT - 1)
19
20 // outer lines away from the illustration edges.
21 return 0.04 + progress * 0.92
22})
23
24type FlexibleLineProps = {
25 position: number
26 pointerX: MotionValue<number>
27 interaction: MotionValue<number>
28 reduceMotion: boolean
29}
30
31function FlexibleLine({ position, pointerX, interaction, reduceMotion }: FlexibleLineProps) {
32 const influence = useTransform(() => {
33 if (reduceMotion) return 0
34
35 const distance = pointerX.get() - position
36 const influenceRadius = 0.17
37
38 return Math.exp(-Math.pow(distance / influenceRadius, 2))
39 })
40
41 const left = useTransform(() => {
42 if (reduceMotion) {
43 return `${position * 100}%`
44 }
45
46 const pointer = pointerX.get()
47 const amount = interaction.get()
48 const distance = pointer - position
49 const strength = influence.get()
50
51 const flexiblePosition = position + distance * strength * amount * 0.88
52
53 return `${clamp(flexiblePosition, 0.02, 0.98) * 100}%`
54 })
55
56 const opacity = useTransform(() => {
57 if (reduceMotion) return 0.24
58
59 const amount = interaction.get()
60 const strength = influence.get()
61
62 return 0.2 + amount * (0.08 + strength * 0.72)
63 })
64
65 const scaleY = useTransform(() => {
66 if (reduceMotion) return 1
67
68 return 1 + interaction.get() * influence.get() * 0.16
69 })
70
71 const scaleX = useTransform(() => {
72 if (reduceMotion) return 1
73
74 return 1 + interaction.get() * influence.get() * 0.65
75 })
76
77 return (
78 <motion.span
79 className="absolute inset-y-[16%] w-px origin-center bg-foreground"
80 style={{
81 left,
82 x: '-50%',
83 opacity,
84 scaleX,
85 scaleY,
86 }}
87 />
88 )
89}
90
91export function FlexibleAtScaleIllustration() {
92 const reduceMotion = useReducedMotion() ?? false
93
94 const rawPointerX = useMotionValue(0.5)
95 const rawInteraction = useMotionValue(0)
96
97 const pointerX = useSpring(rawPointerX, {
98 stiffness: 280,
99 damping: 30,
100 mass: 0.35,
101 })
102
103 const interaction = useSpring(rawInteraction, {
104 stiffness: 220,
105 damping: 24,
106 mass: 0.4,
107 })
108
109// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • components/illustrations/FlexibleAtScaleIllustration.tsx

Facts

Registry
navdeep-singh
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

ui.navdeepsingh.dev Navdeepannu/Portfolio on GitHub Raw registry item This item as JSON

More from navdeep-singh

All 62 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Animated Groupanimated-groupnavdeep-singhComponentsFree1 dep
Animated Numbersanimated-numbersnavdeep-singhComponentsFree1 dep
Animated Tabsanimated-tabsnavdeep-singhComponentsFree2 deps
Approval Panel Illustrationapproval-panelnavdeep-singhComponentsFree2 deps · 2 files
Brand Logobrand-logonavdeep-singhComponentsFree1 dep
Designed for Focus Illustrationdesigned-for-focus-illustrationnavdeep-singhComponentsFree1 dep
Expandable Cardexpandable-cardnavdeep-singhComponentsFree4 deps
Fast by Default Illustrationfast-by-default-illustrationnavdeep-singhComponentsFree1 dep
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex