Attention

Floating Animation

A slow vertical float for hero images and decorative elements.

Edit this in the studio

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

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

@keyframes float-anim {
  0% {
    transform: translate3d(180px, 100px, 0);
    animation-timing-function: ease-in-out;
  }
  50% {
    transform: translate3d(180px, 82px, 0);
    animation-timing-function: ease-in-out;
  }
  100% {
    transform: translate3d(180px, 100px, 0);
  }
}

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

Why it is built this way

Slow and small: a couple of seconds and under 20px. This is ambient motion, so it should be something you notice only when you look for it. Use ease-in-out so there is no visible stop at either end of the travel.

What it animates

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

Y
transform
0 0px
3 stopscompositor

What it costs to run

Y 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 2.40s across 3 keyframe stops, with every property moving over the same window.

One curve throughout: Ease In Out on a plain box. Keeping a single easing across every property is what makes a multi-property animation read as one movement rather than several things happening at once.

Accessibility

Nothing here hides content — y moves over 2.40s 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

floatloopheroidle