Glides in from the left on an expo ease-out while a shorter linear fade runs alongside. Two animations on one element, so the opacity is done before the motion settles.
Also known as: css fade in from left, fade in left to right css, fade in from the side.
<div class="kfa-fade-in-left">Left</div>
.kfa-fade-in-left {
--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);
animation:
kfa-fade-in-left-fade 0.45s linear both,
kfa-fade-in-left-move 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes kfa-fade-in-left-fade {
from { opacity: 0; }
}
@keyframes kfa-fade-in-left-move {
from { transform: translateX(-3em); }
}
@media (prefers-reduced-motion: reduce) {
.kfa-fade-in-left, .kfa-fade-in-left *, .kfa-fade-in-left::before, .kfa-fade-in-left::after, .kfa-fade-in-left *::before, .kfa-fade-in-left *::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.