Designed for Focus Illustration
navdeep-singh/designed-for-focus-illustrationFreeComponent
An interactive focus illustration with concentric motion and reduced-motion support.
Install it
npx shadcn@latest add https://ui.navdeepsingh.dev/r/designed-for-focus-illustration.jsonSource
1'use client'23import { useState } from 'react'4import { motion, useReducedMotion } from 'motion/react'56const FOCUS_DURATION = 3.678const FOCUS_TIMES = [0, 0.12, 0.34, 0.48, 0.68, 0.8, 0.89, 0.94, 1]910const focusCircles = [11 {12 id: 'outer',13 initialX: -44,14 initialOpacity: 0.48,15 focusScale: 1.42,16 focusOpacity: 0.62,17 },18 {19 id: 'middle',20 initialX: 0,21 initialOpacity: 0.38,22 focusScale: 0.9,23 focusOpacity: 0,24 },25 {26 id: 'inner',27 initialX: 44,28 initialOpacity: 0.48,29 focusScale: 0.56,30 focusOpacity: 1,31 },32] as const3334export function DesignedForFocusIllustration() {35 const reduceMotion = useReducedMotion() ?? false36 const [isHovered, setIsHovered] = useState(false)3738 const shouldAnimate = isHovered && !reduceMotion3940 return (41 <div42 aria-hidden="true"43 className="relative h-45 w-full overflow-hidden md:h-60"44 onPointerEnter={() => setIsHovered(true)}45 onPointerLeave={() => setIsHovered(false)}46 >47 <motion.div48 className="absolute inset-0 flex items-center justify-center"49 initial={false}50 animate={51 shouldAnimate52 ? {53 opacity: [1, 1, 1, 1, 1, 1, 0, 0, 1],54 filter: [55 'blur(0px)',56 'blur(0px)',57 'blur(0px)',58 'blur(0px)',59 'blur(0px)',60 'blur(0px)',61 'blur(8px)',62 'blur(8px)',63 'blur(0px)',64 ],65 scale: [1, 1, 1, 1, 1, 1, 0.94, 0.94, 1],66 }67 : {68 opacity: 1,69 filter: 'blur(0px)',70 scale: 1,71 }72 }73 transition={74 shouldAnimate75 ? {76 duration: FOCUS_DURATION,77 times: FOCUS_TIMES,78 ease: 'easeInOut',79 repeat: Infinity,80 repeatDelay: 0.08,81 }82 : {83 duration: 0.4,84 ease: [0.22, 1, 0.36, 1],85 }86 }87 >88 {focusCircles.map((circle) => (89 <motion.span90 key={circle.id}91 className="absolute size-22 rounded-full border border-foreground/60"92 initial={false}93 animate={94 shouldAnimate95 ? {96 x: [97 circle.initialX,98// … truncated
What it pulls in
npm packages
Files it writes
More from navdeep-singh
All 62 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Groupanimated-group | navdeep-singh | Components | Free | 1 dep | |
| Animated Numbersanimated-numbers | navdeep-singh | Components | Free | 1 dep | |
| Animated Tabsanimated-tabs | navdeep-singh | Components | Free | 2 deps | |
| Approval Panel Illustrationapproval-panel | navdeep-singh | Components | Free | 2 deps · 2 files | |
| Brand Logobrand-logo | navdeep-singh | Components | Free | 1 dep | |
| Expandable Cardexpandable-card | navdeep-singh | Components | Free | 4 deps | |
| Fast by Default Illustrationfast-by-default-illustration | navdeep-singh | Components | Free | 1 dep | |
| Flexible at Scale Illustrationflexible-at-scale-illustration | navdeep-singh | Components | Free | 1 dep |
