Letters pop like kernels in a pan: a squeeze, a burst upward with a full tumble, a small rebound on landing. Hand-picked delays per letter keep the order looking random.
Also known as: popping letters, random bouncing letters, jumping letters random.
<div class="txt-popcorn-text" aria-label="Popcorn!"><span aria-hidden="true"><span style="--i: 0; --d: 0.9s; --r: 1">P</span><span style="--i: 1; --d: 0.25s; --r: -1">o</span><span style="--i: 2; --d: 1.55s; --r: 1">p</span><span style="--i: 3; --d: 0.6s; --r: 1">c</span><span style="--i: 4; --d: 1.2s; --r: -1">o</span><span style="--i: 5; --d: 0s; --r: 1">r</span><span style="--i: 6; --d: 1.8s; --r: -1">n</span><span style="--i: 7; --d: 0.45s; --r: -1">!</span></span></div>
.txt-popcorn-text {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
color: var(--c);}
.txt-popcorn-text span span {
display: inline-block;
transform-origin: 50% 70%;
animation: txt-popcorn-text-pop 2.2s infinite;
animation-delay: var(--d);
}
@keyframes txt-popcorn-text-pop {
0% { transform: translateY(0) rotate(0turn) scale(1, 1); animation-timing-function: ease-in; }
4% { transform: translateY(0) rotate(0turn) scale(1.2, 0.8); animation-timing-function: cubic-bezier(0.1, 0.8, 0.3, 1); }
14% { transform: translateY(-0.8em) rotate(calc(var(--r) * 0.5turn)) scale(0.96, 1.05); animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.5); }
24% { transform: translateY(0) rotate(calc(var(--r) * 1turn)) scale(1.12, 0.88); animation-timing-function: ease-out; }
28% { transform: translateY(-0.1em) rotate(calc(var(--r) * 1turn)) scale(1, 1); animation-timing-function: ease-in; }
/* a full turn looks the same as none, so the loop closes cleanly */
32%, 100% { transform: translateY(0) rotate(calc(var(--r) * 1turn)) scale(1, 1); }
}
@media (prefers-reduced-motion: reduce) {
.txt-popcorn-text, .txt-popcorn-text *, .txt-popcorn-text::before, .txt-popcorn-text::after, .txt-popcorn-text *::before, .txt-popcorn-text *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.