Falls from above, stretched by speed, squashes flat on landing, then hops twice on a shrinking arc. The origin sits at the bottom edge so the squash stays on the floor.
Also known as: drop in animation css, bounce in from top css, drop and bounce.
<div class="kfa-bounce-in-down">Drop</div>
.kfa-bounce-in-down {
--c: var(--kfa-color, #3b82f6);
font-size: var(--kfa-size, 16px);
display: grid;
place-items: center;
width: 5.5em;
height: 5.5em;
border-radius: 1em;
background: var(--c);
color: #fff;
font-family: system-ui, sans-serif;
font-weight: 700;
box-shadow: 0 0.6em 1.4em -0.6em color-mix(in srgb, var(--c) 70%, transparent);
transform-origin: 50% 100%;
animation: kfa-bounce-in-down-kf 1s both;
}
@keyframes kfa-bounce-in-down-kf {
0% {
opacity: 0;
transform: translateY(-2.4em) scale(0.94, 1.1);
animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
}
40% {
opacity: 1;
transform: translateY(0) scale(1.14, 0.84);
animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
58% {
transform: translateY(-0.9em) scale(0.97, 1.04);
animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
}
74% {
transform: translateY(0) scale(1.06, 0.94);
animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
86% {
transform: translateY(-0.2em) scale(1);
animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
}
100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
.kfa-bounce-in-down, .kfa-bounce-in-down *, .kfa-bounce-in-down::before, .kfa-bounce-in-down::after, .kfa-bounce-in-down *::before, .kfa-bounce-in-down *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--kfa-color on the element or a parent.
Currently previewing #3b82f6.--kfa-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.