Updated
Plucked Curve
Customize
Rest10
Pluck26
Duration1.4s
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/plucked-curve.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/plucked-curve/plucked-curve.tsx"use client"; import { cn } from "@/lib/utils"; import { animate } from "motion/react"; import { useEffect, useId, useRef } from "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]"; // 14 — The curve is plucked like a string: it snaps to a deep arc, swings // through flat to the other side, and rings down to its resting bend (a // damped cosine). Letters fade in along it from left to right as it moves. const curve = (bend: number) => `M 0 40 Q 140 ${40 - bend * 2} 280 40`; export function PluckedCurve({ play, text = "carried along a gentle curve",
Adds the files to
components/uibrik/plucked-curve and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/plucked-curve.Usage
import { PluckedCurve } from "@/components/uibrik/plucked-curve/plucked-curve";<PluckedCurve play={0} text="carried along a gentle curve" rest={10} pluck={26} duration={1.4}/>Where to use Plucked Curve
Playful headlines
Text riding a curve that wobbles like a plucked string makes a heading fun.
Music and audio brands
A vibrating line of type suits instruments, audio apps and podcasts.
Creative intros
Curved, moving text gives a portfolio intro character.
Props
PluckedCurve- text
- Type string
- "carried along a gentle curve"
- The copy to animate.
- rest
- Type number
- 10
- Bend of the curve at rest.
- pluck
- Type number
- 26
- Extra bend when plucked.
- duration
- Type number
- 1.4
- Time for the string to ring down.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.