Code
css3
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-30px); }
}
.ball {
animation: bounce 1s ease-in-out infinite;
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/* Pause on hover */
.ball:hover {
animation-play-state: paused;
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
.fade { animation: fade-in 0.5s ease forwards; }