Presets

Flipping square loader

A tile that flips over its X axis, then its Y axis, in 3D perspective.

CSSTailwindReactGIFMP4
trigger: loop
00.000 / 1.400s
timing
style

npm i motion · the component uses motion/react

How it works

This loader is one colored tile that flips like a card: first it tips over backwards around the horizontal axis, then it turns around the vertical axis, and the cycle repeats. It is a single element with no children.

The flip keyframe has three stops. At 0% the transform is rotateX(0) rotateY(0); at 50% rotateX(-180deg); at 100% both axes are at -180deg. Perspective is written inside the transform itself as perspective(Size times 3 px) rather than on a parent, which is why the preset works when you paste it anywhere without a wrapper. Three times the size gives a noticeable but not exaggerated depth.

The flipping square works for compact loaders in cards, for logo-style splash screens (try a brand color with a small radius), and in games or quiz apps where a card flip already fits the theme. Parameters: Size, Color, Corner radius, Duration and Easing. Use cubic-in-out (the default) so each half flip starts slow, snaps through the edge-on moment and settles. Larger Corner radius values make it look like an app icon; 0 gives a crisp tile.

The tile is a single compositor-friendly transform animation. Since it has no back face content, both sides show the same color. Users who are sensitive to motion can find 3D flips more disorienting than flat spinners, so honor prefers-reduced-motion by swapping it for a simple opacity pulse.

Why is perspective inside the keyframes instead of on a parent?

The perspective() function at the start of the transform applies depth to that element alone. That keeps the preset to one element, so you can drop it into any layout without wrapping it in a container with the perspective property. The trade-off is that you cannot share one vanishing point across several tiles; for that, move it to a parent.

Can I show a different color on the back side?

Not with a single element, because the same background shows on both faces. Add two child faces stacked with position absolute, give the back one rotateY(180deg) and backface-visibility: hidden on both, then apply transform-style: preserve-3d to the tile. The flip keyframe can stay the same.

How do I make the depth stronger?

Lower the perspective value. The preset uses three times Size; in the copied CSS change it to twice the size for a more dramatic, close-up flip, or five times for a flatter look. Very small values distort the tile heavily as it passes edge-on.

relatedMore like this

all loaders →
01 Spinner loop
02 Dual ring loop
03 Bouncing dots loop
04 Typing indicator loop
05 Equalizer bars loop
06 Progress bar loop

Export

format
height

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