Free
✨ Creative
Magnetic CTA Cluster
Buttons that pull toward the cursor within a radius, with the label lagging behind the shell for weight.
3.9k views 710 copies 330 palavras
O prompt
# Magnetic CTA Cluster — Interactive Button Set ## Goal Build a set of magnetic buttons (primary, ghost, icon-only) that translate toward the pointer while it is within an activation radius, with the inner label trailing the outer shell. It must drop cleanly into an existing Next.js + Tailwind project as a self-contained component. ## Design Spec - Each button is two nested elements: an outer shell that moves, and an inner label that moves at 40% of the shell's offset — the lag is what sells the weight. - Activation radius = the button's bounding box inflated by 60px; pull maxes out at 12px translation. - Primary: solid fill with a 1px inner highlight; ghost: 1px border that brightens with proximity; icon-only: 44px circle. - Focus-visible ring sits on the shell and must not inherit the magnetic transform — the ring has to stay legible while the button moves. ## Motion Spec - Pull is proportional to `1 - distance / radius`, eased with a spring (stiffness 260, damping 22). - Return to rest over ~420ms when the pointer leaves the radius; never snap. - Press: scale 0.97 with a 90ms ease-out, then release to 1 with a light overshoot. - All pointer math in a single rAF shared across the cluster — one listener on the container, not one per button. - Respect `prefers-reduced-motion` — provide a static fallback that still looks intentional. ## Component API - Props: `radius?: number` (default 60), `strength?: number` (default 12), `as?: 'button' | 'a'` with correct semantics for each. - Disable magnetism entirely on coarse pointers (`(pointer: coarse)`) and under `prefers-reduced-motion`. - Forward refs and spread rest props so the buttons drop into existing forms and links unchanged. ## Quality Bar - TypeScript strict, zero `any`. Tailwind only — no external CSS files. - Works on mobile: touch targets ≥ 44px, no hover-only affordances. - 60fps: animate only `transform` and `opacity`; use `will-change` sparingly. - Accessible: correct roles/aria, keyboard operable, focus-visible styles.
Você também pode gostar
Free
Cast & Render
✨ Creative
Single-file scroll-scrubbed landing for a 3D studio: scrolling scrubs a fixed all-intra background video frame by frame while three text panels cross-fade over it, with no framework and no build step.
1.2k 797CursorClaude CodeLovable
Free
Aethera
✨ Creative
Fullscreen white hero: an Instrument Serif headline over a looping video band that hand-fades in and out on every pass.
4.1k 358CursorClaude CodeLovable
Free
Figurine Carousel Hero
✨ Creative
Full-viewport figurine carousel where background colour, scale, blur and position all crossfade together on one 650ms curve.
2.8k 557CursorClaude CodeLovable
Free
Featured
Augment Reveal Hero
✨ Creative
Cyberpunk hero where a cursor spotlight reveals the augmented version of the portrait, with stats drawn on fading circular arcs.
4.1k 132CursorClaude CodeLovable