Performance: Bounce animation (attention)
Bounce animations affect the visual stability and interaction responsiveness by triggering repaints and potentially layout shifts.
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(20px); }
}
.element {
animation: bounce 1s infinite;
will-change: transform;
}@keyframes bounce {
0%, 100% { top: 0; }
50% { top: 20px; }
}
.element {
position: relative;
animation: bounce 1s infinite;
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Animating 'top' property | None | 1 per frame | High (layout + paint) | [X] Bad |
| Animating 'transform: translateY()' | None | 0 | Low (composite only) | [OK] Good |
animate-bounce do to an element?animate-bounceanimate-bounce class in Tailwind CSS applies a smooth up-and-down movement to the element.animate-bounce does.animate-bounce, not variations like bounce-animation or bounce.class="animate-bounce" correctly on the button element.animate-bounce class exactly [OK]<button class="animate-bounce bg-blue-500 text-white p-4 rounded">Bounce</button>
animate-bounce for bounce animation, bg-blue-500 for blue background, text-white for white text, p-4 for padding, and rounded for rounded corners.<p class="bounce">Hello</p> does not animate. What is the problem?bounce is not a valid Tailwind animation class. The correct class is animate-bounce.animate-bounce, not bounce -> Option Danimate-bounce [OK]hover: prefix to apply styles on hover. To stop animation on hover, use hover:animate-none.<div class="animate-bounce hover:animate-none">🔔</div> correctly uses animate-bounce and stops animation on hover with hover:animate-none. Other options use invalid classes or do not stop animation.Pass the test and this pattern moves unknown