@hellouxpavel/cssanimation
Version:
A Powerful CSS Animation Library for Advanced Motion Design.
161 lines (126 loc) • 2.95 kB
CSS
.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 ;
}
}
: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;
}
.ca__fx-bobble {
animation-name: bobble;
transform-origin: center;
}
@keyframes bobble {
0%,
100% {
transform: translateX(0%);
}
15% {
transform: translateX(-25%) rotate(-5deg);
}
30% {
transform: translateX(20%) rotate(3deg);
}
45% {
transform: translateX(-15%) rotate(-3deg);
}
60% {
transform: translateX(10%) rotate(2deg);
}
75% {
transform: translateX(-5%) rotate(-1deg);
}
90% {
transform: translateX(2%) rotate(0.ca__fx-5deg);
}
}
.ca__fx-jelly {
animation-name: jelly;
}
@keyframes jelly {
0% {
transform: scale(1, 1);
}
25% {
transform: scale(0.ca__fx-9, 1.ca__fx-1);
}
50% {
transform: scale(1.ca__fx-1, 0.ca__fx-9);
}
75% {
transform: scale(0.ca__fx-95, 1.ca__fx-05);
}
100% {
transform: scale(1, 1);
}
}
.ca__fx-perspectiveTilt {
animation-name: perspectiveTilt;
}
@keyframes perspectiveTilt {
50% {
transform: perspective(400px) rotateY(10deg);
}
}
.ca__fx-jello {
animation: jello var(--jello-duration, 0.ca__fx-9s) both;
}
@keyframes jello {
0%,
100% {
transform: none;
}
30% {
transform: skewX(-12.ca__fx-5deg) skewY(-12.ca__fx-5deg);
}
40% {
transform: skewX(6.ca__fx-25deg) skewY(6.ca__fx-25deg);
}
50% {
transform: skewX(-3.ca__fx-125deg) skewY(-3.ca__fx-125deg);
}
65% {
transform: skewX(1.ca__fx-5625deg) skewY(1.ca__fx-5625deg);
}
75% {
transform: skewX(-0.ca__fx-78125deg) skewY(-0.ca__fx-78125deg);
}
}
.ca__fx-waveBand {
animation-name: waveBand;
transform-origin: center center;
}
@keyframes waveBand {
0%,
100% {
transform: scaleY(1) translateY(0); /* Normal state */
}
25% {
transform: scaleY(1.ca__fx-1) translateY(-5px); /* Stretch vertically and move up slightly */
}
50% {
transform: scaleY(0.ca__fx-9) translateY(5px); /* Compress vertically and move down */
}
75% {
transform: scaleY(1.ca__fx-05) translateY(-2px); /* Slight overshoot */
}
}