Attention

CSS Spin Animation

A continuous 360-degree rotation.

Edit this in the studio

Opens with this animation loaded. Nothing is uploaded — the scene travels in the link.

animation.css
.spin {
  transform: translate3d(180px, 100px, 0);
  width: 120px;
  height: 120px;
  background: #6366f1;
  border-radius: 20px;
  animation: spin-anim 1200ms linear 0ms infinite both;
  will-change: transform, opacity;
}

@keyframes spin-anim {
  0% {
    transform: translate3d(180px, 100px, 0);
  }
  100% {
    transform: translate3d(180px, 100px, 0) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spin {
    animation: none;
    transition: none;
  }
}

Why it is built this way

One keyframe pair and a linear timing function. Linear matters — any easing makes a continuous rotation appear to stutter each time it loops, because the speed resets at the seam.

What it animates

1 property across 1 CSS declaration. The bar shows when each one is moving.

Rotate
transform
0 360
2 stopscompositor

What it costs to run

Rotate is handled by the compositor: no layout, no repaint, and the work can run off the main thread. This is the cheap end of CSS animation, which is why it stays smooth on a slow phone where other properties will not.

It runs for 1.20s across 2 keyframe stops, with every property moving over the same window.

A single linear curve on a plain box. Linear looks wrong on almost anything that starts and stops — but it is exactly right here, because a continuous loop that eases would visibly stutter at the seam where it repeats.

Accessibility

Nothing here hides content — rotate moves over 1.20s and the element is visible throughout. The exported prefers-reduced-motion guard still silences it, which matters most for the looping ones: motion that never stops is the kind that makes people feel unwell.

Related animations

spinrotateloopinfinite