AI CSS Animations

Clock Loader

A clock face whose hands sweep round at different speeds. A literal metaphor that suits scheduling, timers, and 'this may take a minute' waits.

HTML

<div class="ldr-clock" role="status" aria-label="Loading"></div>

CSS

.ldr-clock {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  position: relative;
  width: var(--s);
  height: var(--s);
  border: calc(var(--s) / 16) solid var(--c);
  border-radius: 50%;
}
.ldr-clock::before,
.ldr-clock::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: calc(var(--s) / 16);
  margin-left: calc(var(--s) / -32);
  border-radius: 999px;
  background: var(--c);
  transform-origin: 50% 100%;
}
.ldr-clock::before {
  height: 28%;
  animation: ldr-clock-sweep 6s linear infinite;
}
.ldr-clock::after {
  height: 38%;
  animation: ldr-clock-sweep 1s linear infinite;
}
@keyframes ldr-clock-sweep {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-clock, .ldr-clock *, .ldr-clock::before, .ldr-clock::after {
    animation-duration: 3s;
  }
}

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries role="status" and an aria-label so screen readers announce the wait. The reduced-motion rule at the end slows the animation for users who asked for less motion.

Similar loaders