AI CSS Animations

Googly Eyes Text

The two O's in the word are eyes that glance left, glance right, roll up and blink. The pupils are pseudo-elements sharing one keyframe, and the blink squashes each eye with scaleY.

Also known as: eyes looking around css, blinking eyes text, cartoon eyes animation.

Lk

HTML

<div class="txt-googly-eyes-text" aria-label="Look">L<span class="txt-googly-eyes-text-eyes" aria-hidden="true"><i></i><i></i></span>k</div>

CSS

.txt-googly-eyes-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;
  display: inline-flex;
  align-items: baseline;
  color: var(--c);}
.txt-googly-eyes-text-eyes {
  display: inline-flex;
  gap: 0.05em;
  margin: 0 0.04em;
}
.txt-googly-eyes-text i {
  position: relative;
  box-sizing: border-box;
  width: 0.6em;
  height: 0.6em;
  border: 0.08em solid var(--c);
  border-radius: 50%;
  background: #fff;
  animation: txt-googly-eyes-text-blink 4s infinite;
}
/* the pupil */
.txt-googly-eyes-text i::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.24em;
  height: 0.24em;
  margin: -0.12em 0 0 -0.12em;
  border-radius: 50%;
  background: var(--c);
  animation: txt-googly-eyes-text-look 4s cubic-bezier(0.5, 0, 0.2, 1) infinite;
}
@keyframes txt-googly-eyes-text-look {
  0%, 8%, 76%, 100% { transform: translate(0, 0); }
  12%, 30% { transform: translate(-0.12em, 0.03em); }
  34%, 52% { transform: translate(0.12em, 0.03em); }
  57%, 70% { transform: translate(0.02em, -0.12em); }
}
@keyframes txt-googly-eyes-text-blink {
  0%, 84%, 90%, 100% { transform: scaleY(1); }
  87% { transform: scaleY(0.1); }
}

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