Performance: Ping animation (notifications)
MEDIUM IMPACT
Ping animations affect the visual smoothness and interaction responsiveness by triggering continuous repaints and compositing.
<div class="relative"> <span class="absolute inline-flex h-4 w-4 rounded-full bg-red-400 opacity-75 animate-ping will-change-transform"></span> <span class="relative inline-flex rounded-full h-4 w-4 bg-red-500"></span> </div>
<div class="relative"> <span class="absolute inline-flex h-4 w-4 rounded-full bg-red-400 opacity-75 animate-ping"></span> <span class="relative inline-flex rounded-full h-4 w-4 bg-red-500"></span> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Ping animation without will-change | Minimal DOM nodes | 0 reflows if size unchanged | High paint cost due to opacity animation | [X] Bad |
| Ping animation with will-change: transform | Minimal DOM nodes | 0 reflows | Low paint cost, uses compositor | [OK] Good |