Animations CSS3 Avancees
Les animations CSS permettent de creer des interfaces dynamiques sans JavaScript.
Transitions
.bouton {
background: #3498db;
transition: all 0.3s ease;
}
.bouton:hover {
background: #2980b9;
transform: scale(1.05);
}
Keyframes
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.element {
animation: fadeIn 0.5s ease forwards;
}
Animation de chargement
@keyframes spin {
to { transform: rotate(360deg); }
}
.loader {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
Proprietes d'animation
- animation-name : Nom du keyframe
- animation-duration : Duree
- animation-timing-function : Courbe
- animation-delay : Delai
- animation-iteration-count : Repetitions
- animation-fill-mode : Etat final
Performance
Privilegiez transform et opacity pour des animations fluides a 60fps.