AI CSS Animations

Pop In

The whole word scales up from half size with a little overshoot, like a notification badge appearing. One keyframe and a springy easing curve.

Also known as: scale in text, zoom in text, bounce in.

New!

HTML

<div class="txt-pop-in">New!</div>

CSS

.txt-pop-in {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  display: inline-block;
  color: var(--c);
  opacity: 0;
  animation: txt-pop-in-scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;}
@keyframes txt-pop-in-scale {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-pop-in, .txt-pop-in *, .txt-pop-in::before, .txt-pop-in::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations