forever components

UI Micro-interactions

Star Rating Cascade

Five gold stars fill left-to-right in a staggered cascade with squash-pop scaling and sparkle flicks off each tip, then drain in reverse and repeat.

canvasmedium complexitymoderate motionclick

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

Rating confirmations, review submission feedback, onboarding success moments on dark backgrounds.

When not to

Light-background UIs (background hardcoded dark amber). Interactive rating pickers — this is display-only; click only restarts the loop.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change star count to 3, increase STAGGER to 18 for a slower cascade, and set GOLD to '#FF6B6B' for a red-heart rating variant. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.

Safe to edit

  • star count (stars array length + loop bounds)
  • cascade speed (STAGGER=12, FILL=26)
  • hold duration (HOLD=130)
  • gold color (GOLD='#FBBF24')
  • star radius (R=gap*0.40)
  • squash/stretch amounts (0.18, 0.26 sin coefficients)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • DPR-aware canvas sizing
  • IIFE wrapper
  • visibilitychange pause/resume
  • prefers-reduced-motion static fallback (all stars filled)
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • Light re-theme via the [data-theme=light] token block; catalog bg/accent describe the dark default
  • Click resets the cascade but does not support interactive per-star selection
  • No reduced-motion fallback animation — shows static filled state only

starsratingcascadecanvasmicrointeractiongoldui-control

More UI Micro-interactions components

  • Add to Cart FlyProduct tile flings a mini clone in a bezier arc into a cart icon on click; badge count bumps with a spring bounce. Auto-cycles as demo.
  • Notification BellSVG bell swings and rings with a ripple wave on click; a red badge counter pops in with a springy bounce and increments each ring. Auto-cycles every 2…
  • Copy ConfirmCopy icon morphs to a drawn-stroke checkmark with a green button flash and a "Copied!" toast on click; auto-cycles as a demo loop.
  • Swipe Card StackTinder-style draggable card stack — drag the top card left/right to reveal NOPE/LIKE stamps; fling-away animates it off-screen and cycles to the next card.
  • Pull to RefreshA phone-frame mockup with draggable list rows; pulling down reveals a teal arc spinner that fills and rotates, then triggers a skeleton-row flash on release.
  • Accordion ExpandThree FAQ panels smoothly expand and collapse with a CSS height transition; a chevron rotates 180 degrees to indicate open state. Auto-cycles as demo.