No.288 · Micro-animations
Bell Ring
A notification bell that swings from its hook and dies down, the clapper a beat behind, while the badge pops up a number.
The prompt
The design brief behind this component — reuse it to regenerate, remix, or explain it.
Build a notification bell icon button with an unread badge, where a new notification rings it like a real bell. The bell swings from its hook (transform-origin at the top of the dome): +24°, −20°, +14°, −9°, +5°, −2°, 0 over 1.1s; the clapper (the little arc under the bell) swings the opposite way, 60ms behind, with smaller amplitude, so it reads as a pendulum inside a pendulum. Two identical keyframes alternate on each new notification so it replays without remounting. The badge (red, ring in the page colour, tabular count, "9+" cap) pops in springily (scale 0.2 → 1.25 → 1) whenever the count changes. Opening the bell clears the count and the badge scales away. The ring only plays when the count goes up.
Notes
- Interaction
- New notifications ring the bell; click to open and clear the badge. The demo has a button to simulate one.
- Motion
- Swing 1.1s with decaying amplitude; clapper 60ms behind; badge pop 460ms.
- Accessibility
- The button's label includes the unread count ("Notifications, 3 unread"). Reduced motion keeps the bell still and the badge static.
- 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.