AI CSS Animations

Hologram Text Effect

Translucent, scan-lined letters float over a projector beam, flicker, and get swept by a bright scan bar. The lines are a scrolling mask, the beam is a clipped gradient under the word.

Also known as: holographic text css, sci fi hologram text, projected text effect.

HOLOGRAM

HTML

<div class="txt-hologram-text"><span class="txt-hologram-text-word">HOLOGRAM</span></div>

CSS

.txt-hologram-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;
  position: relative;
  display: inline-block;
  isolation: isolate;
  padding: 0 0.4em 0.9em;
  font-weight: 800;
  letter-spacing: 0.12em;}
/* projector beam */
.txt-hologram-text::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0.3em;
  bottom: 0.1em;
  z-index: -1;
  background: linear-gradient(0deg, color-mix(in srgb, var(--c) 45%, transparent), transparent 85%);
  clip-path: polygon(0 0, 100% 0, 58% 100%, 42% 100%);
  animation: txt-hologram-text-flicker 3s steps(1, end) infinite;
}
/* emitter */
.txt-hologram-text::after {
  content: "";
  position: absolute;
  left: 40%;
  right: 40%;
  bottom: 0;
  height: 0.2em;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0.3em var(--c);
}
.txt-hologram-text-word {
  display: inline-block;
  background:
    linear-gradient(180deg, transparent 42%, color-mix(in srgb, var(--c) 25%, #fff) 50%, transparent 58%) 0 150% / 100% 300% no-repeat,
    linear-gradient(var(--c), var(--c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 0.3em color-mix(in srgb, var(--c) 45%, transparent);
  -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 0.06em, rgb(0 0 0 / 0.35) 0.06em 0.1em);
  mask-image: repeating-linear-gradient(180deg, #000 0 0.06em, rgb(0 0 0 / 0.35) 0.06em 0.1em);
  animation:
    txt-hologram-text-sweep 2.4s cubic-bezier(0.5, 0, 0.5, 1) infinite,
    txt-hologram-text-lines 0.8s linear infinite,
    txt-hologram-text-flicker 3s steps(1, end) infinite;
}
@keyframes txt-hologram-text-sweep {
  from { background-position: 0 150%, 0 0; }
  to   { background-position: 0 -50%, 0 0; }
}
/* 0.1em = one line period, so the scroll loops without a seam */
@keyframes txt-hologram-text-lines {
  to { -webkit-mask-position: 0 -0.1em; mask-position: 0 -0.1em; }
}
@keyframes txt-hologram-text-flicker {
  0%, 22%, 63%, 100% { opacity: 0.92; transform: none; }
  20% { opacity: 0.6; }
  61% { opacity: 0.35; transform: skewX(-10deg) translateX(0.04em); }
}

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