@hellouxpavel/cssanimation
Version:
A Powerful CSS Animation Library for Advanced Motion Design.
70 lines (57 loc) • 1.56 kB
CSS
/*!
* Module: elasticBounce Animation
* Usage: <div class="cssanimation ca__fx-elasticBounce">Your Content</div>
*/
/* stylelint-disable */
:root {
--cssanimation-duration: 1s;
--cssanimation-fill-mode: both;
--cssanimation-infinite: infinite;
--cssanimation-backface-visibility: hidden;
--cssanimation-transform-style: preserve-3d;
--cssanimation-will-change: transform, opacity;
--cssanimation-display: inline-block;
--move-distance: -800px;
}
.cssanimation {
animation-duration: var(--cssanimation-duration, 1s);
animation-fill-mode: var(--cssanimation-fill-mode, both);
}
.cssanimation span {
display: var(--cssanimation-display, inline-block);
}
.infinite {
animation-iteration-count: var(--cssanimation-infinite, infinite) ;
}
@media (prefers-reduced-motion: reduce) {
.cssanimation,
.cssanimation span {
animation: none ;
transition: none ;
}
}
/* stylelint-enable */
.ca__fx-elasticBounce {
animation: elasticBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
transform-origin: bottom center; /* Important for bouncing */
}
@keyframes elasticBounce {
0% {
transform: translateY(0) scale(1);
}
20% {
transform: translateY(-30px) scaleX(1.05) scaleY(0.95);
}
40% {
transform: translateY(0) scaleX(0.98) scaleY(1.02);
}
60% {
transform: translateY(-15px) scaleX(1.02) scaleY(0.98);
}
80% {
transform: translateY(0) scaleX(0.99) scaleY(1.01);
}
100% {
transform: translateY(0) scale(1);
}
}