Presets

CSS animation rotate (360 degrees)

A shape spinning a full turn on repeat, with control over direction, speed and easing.

CSSTailwindReactGIFMP4
trigger: loop
00.000 / 2.000s
timing
style

npm i motion · the component uses motion/react

How it works

This is the plain CSS rotate animation: an element spinning a full 360 degrees, as many times as you want. It is the base for spinning icons, refresh buttons, sync indicators, decorative badges and logos that turn slowly in the background.

The keyframe has two steps, from transform: rotate(0deg) to rotate(360deg). Because 360 degrees looks identical to 0, the loop has no visible jump. Everything interesting happens in the animation properties, which the preset exposes directly: Duration, Easing, Direction (normal, reverse or alternate) and Iterations (infinite, 1, 2, 3 or 5). Fill-mode both keeps the element at its final angle when a finite animation ends.

Parameters also include Size, Color and Corner radius on the demo square. Combine them for different uses. Linear easing with infinite iterations gives a steady spin for loaders and sync icons. Iterations 1 with expo-out turns it into a single "refreshed" flourish. Alternate makes the element turn forward then back, which works for a wobbling bell or settings gear. Slow durations (10s and up) suit decorative rotating text badges.

Rotation is pure transform, so it is composited and smooth at any size. Note that a fully round shape (Corner radius at half of Size) shows no visible rotation; spin something with an asymmetric detail. Continuous decorative spinning should stop under prefers-reduced-motion.

How do I rotate 360 degrees infinitely in CSS?

Define a keyframe from rotate(0deg) to rotate(360deg) and apply it with linear easing and infinite iteration count, for example animation: rotate 2s linear infinite. Linear matters: any other easing slows the element down at the end of each turn, which looks like a stutter when the turns are chained together.

How do I rotate an element only once, on click?

Set Iterations to 1 in the editor and copy the code. Then add the animation class with JavaScript when the button is clicked and remove it on animationend, so the next click can replay it. In the React version, you can increment a key or toggle the animate target to trigger the turn again.

Why does my rotating element wobble?

Usually the transform-origin is not at the visual center, for example when an icon has uneven padding inside its viewBox or the element has an odd pixel size. Set transform-origin: center explicitly and make sure the box is square. For SVG icons, transform-box: fill-box helps center rotation on the drawn shape.

relatedMore like this

all css animations →
01 Animated arrow loop
NEON
02 Neon glow text loop
03 Blink loop
04 Heartbeat pulse loop

Export

format
height

480p max · small watermark · 3 per day · remove limits