AI CSS Animations

Slow Push In Title

A widescreen frame with a dark vignette slowly pushes in on a film title, fading up from black and back down at each end. A linear nine second scale reads as a steady camera move.

Also known as: cinematic title card css, film title vignette, ken burns text.

NIGHTFALL

a film by June Park

HTML

<div class="txt-slow-push-in-title">
  <div class="txt-slow-push-in-title-shot">
    <p class="txt-slow-push-in-title-main">NIGHTFALL</p>
    <p class="txt-slow-push-in-title-sub">a film by June Park</p>
  </div>
</div>

CSS

.txt-slow-push-in-title {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
  display: grid;
  place-items: center;
  width: 12em;
  aspect-ratio: 2.39;
  overflow: hidden;
  border-radius: 0.2em;
  background: color-mix(in srgb, var(--c) 16%, #05060a);}
/* the vignette: dark corners over the shot */
.txt-slow-push-in-title::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.75) 100%);
}
.txt-slow-push-in-title-shot {
  text-align: center;
  animation: txt-slow-push-in-title-push 9s linear -1.6s infinite;
}
.txt-slow-push-in-title-main {
  margin: 0;
  padding-left: 0.4em;
  font-size: 0.95em;
  font-weight: 300;
  letter-spacing: 0.4em;
  color: color-mix(in srgb, var(--c) 40%, #fff);
}
.txt-slow-push-in-title-sub {
  margin: 0.4em 0 0;
  font-size: 0.3em;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 55%, #fff);
  opacity: 0.7;
}
@keyframes txt-slow-push-in-title-push {
  0%   { opacity: 0; transform: scale(0.94); }
  14%  { opacity: 1; }
  84%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-slow-push-in-title, .txt-slow-push-in-title *, .txt-slow-push-in-title::before, .txt-slow-push-in-title::after, .txt-slow-push-in-title *::before, .txt-slow-push-in-title *::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