Last updated
Animation Performance Tips
- Use
transformandopacity— these are GPU-accelerated and run at 60fps - Avoid animating
width,height,top,left— these trigger layout recalculation - Use
will-change: transformto hint the browser to promote the element to its own layer - Keep animations under 300ms for UI feedback, 500ms for entrance animations
- Always include
prefers-reduced-motionmedia query for accessibility - Use
animation-fill-mode: forwardsto keep the final state after the animation ends
The CSS Animation Generator on TechConverter.me provides a visual interface for designing keyframe animations with real-time preview. Configure your keyframes, timing function, duration, and iteration count, then copy the generated CSS directly into your stylesheet.
Examples
Example 1: Fade In Animation
A simple fade-in for page elements as they load:
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fade-in {
animation: fadeIn 0.5s ease-in-out forwards;
}
/* With a delay for staggered elements */
.card:nth-child(1) { animation: fadeIn 0.5s ease-out 0.0s forwards; }
.card:nth-child(2) { animation: fadeIn 0.5s ease-out 0.1s forwards; }
.card:nth-child(3) { animation: fadeIn 0.5s ease-out 0.2s forwards; }
Example 2: Slide In from Left
A navigation menu or sidebar that slides in from the left:
@keyframes slideInLeft {
from {
transform: translateX(-100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.sidebar {
animation: slideInLeft 0.3s ease-out forwards;
}
/* Slide in from different directions */
@keyframes slideInRight {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInUp {
from { transform: translateY(100%); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes slideInDown {
from { transform: translateY(-100%); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
Example 3: Bounce Animation for Attention
A notification badge or CTA button that bounces to draw attention:
@keyframes bounce {
0%, 100% {
transform: translateY(0);
animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
}
50% {
transform: translateY(-25%);
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
}
}
.notification-badge {
animation: bounce 1s infinite;
}
/* Bounce in (one-time entrance) */
@keyframes bounceIn {
0% { transform: scale(0.3); opacity: 0; }
50% { transform: scale(1.05); opacity: 0.8; }
70% { transform: scale(0.9); }
100% { transform: scale(1); opacity: 1; }
}
.modal {
animation: bounceIn 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}