No.512 · Micro-animations
Heart Burst
A like button with one good moment: the heart pops, a ring blooms, sparks fly and the count rolls up.
The prompt
Written for the variant you picked above: Paper
Build a like button (a pill with a heart and a count, aria-pressed) whose like has one good moment. Liking: the heart fills red (#ff4d6d) with a springy pop (scale 0.2 → 1.28 → 0.94 → 1, 520ms), a ring blooms out from behind it (scale 0.3 → 2.1 while its border thins and fades), seven small sparks in red, amber, violet and teal fly out on evenly spaced angles and shrink away, and the count rolls up one digit (a two-row reel translated −50%, 420ms). The pill border and background tint red. Unliking is quiet: the heart just empties and the count rolls back down, with no burst. The effect layer is re-keyed per like so it replays. Pressing scales the heart to 0.86. Selected variant — Paper (paper): Apply the paper theme. Where the brief above gives no colour values for it, choose a restrained paper palette with text at 4.5:1 contrast or better. Keep the geometry, states and motion described above unchanged. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click, tap, Space or Enter to like and unlike. Motion: Pop 520ms springy; ring and sparks 520–620ms; count reel 420ms. Accessibility: A real toggle button with aria-pressed and a label that includes the count; the burst is decorative. Reduced motion skips the pop, ring and sparks. Responsive behavior: A fixed-size control that sits inline wherever it's placed; nothing depends on screen width. Touch: Works the same on touch; there's no hover-only behaviour. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Click, tap, Space or Enter to like and unlike.
- Motion
- Pop 520ms springy; ring and sparks 520–620ms; count reel 420ms.
- Accessibility
- A real toggle button with aria-pressed and a label that includes the count; the burst is decorative. Reduced motion skips the pop, ring and sparks.
- Responsive
- A fixed-size control that sits inline wherever it's placed; nothing depends on screen width.
- On touch
- Works the same on touch; there's no hover-only behaviour.