CSS Orb Loader: A Glowing AI Loading Animation in Plain CSS | HorizonX
← The Journal

CSS

CSS Orb Loader: A Glowing AI Loading Animation in Plain CSS

Build a glowing orb loader with plain CSS: a gradient sphere, a soft pulse and a light sweep. Accessible, reduced-motion safe and tested in Chromium.

Marcelo Cedeño

Marcelo Cedeño

·4 min read

CSS Orb Loader: A Glowing AI Loading Animation in Plain CSS
  • Meta description: Build a glowing orb loader with plain CSS: a gradient sphere, a soft pulse and a light sweep. Accessible, reduced-motion safe and tested in Chromium.
  • Slug: css-orb-loader
  • Target query: css orb loader

An orb loader is a glowing sphere that breathes while something is working, the look many AI products use for "thinking". You can build one with one element, two pseudo-elements and about 40 lines of CSS, with no JavaScript and no image. This guide builds it step by step and keeps it accessible.

The markup#

<div class="orb" role="status">
  <span class="orb-label">Generating a reply</span>
</div>

role="status" tells screen readers that this region reports progress, and the visually hidden label gives them something to announce. Change the text to say what is actually happening.

The sphere#

A sphere is a circle with a radial gradient whose bright point sits off-centre, plus an inner shadow for depth.

.orb {
  --size: 96px;
  position: relative;
  isolation: isolate;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%,
    #fff 0, #c7d3ff 14%, #4d63d6 52%, #0f1a4d 100%);
  box-shadow: inset 0 -8px 18px rgb(8 14 60 / 0.55);
  animation: orb-breathe 2.4s ease-in-out infinite;
}

isolation: isolate keeps the glow, which sits behind the sphere, inside the orb's own stacking context so it cannot slip behind the page background.

The glow and the light sweep#

The glow is a blurred radial gradient behind the sphere. The sweep is a rotating cone of light, masked so it only shows on the sphere's body.

.orb::before {                     /* glow */
  content: "";
  position: absolute;
  inset: -18%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(90 120 255 / 0.55), transparent 70%);
  animation: orb-glow 2.4s ease-in-out infinite;
}

.orb::after {                      /* light sweep */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0 55%, rgb(255 255 255 / 0.75) 85%, transparent 100%);
  mask-image: radial-gradient(circle, transparent 20%, #000 70%);
  animation: orb-spin 1.6s linear infinite;
}

The animation#

@keyframes orb-breathe { 50% { transform: scale(0.92); } }
@keyframes orb-glow    { 50% { opacity: 0.45; } }
@keyframes orb-spin    { to  { transform: rotate(1turn); } }

Only transform and opacity change, so the browser can animate the orb without recalculating layout on every frame. That is why the glow fades with opacity instead of animating a box-shadow.

The visually hidden label#

.orb-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

Respect reduced motion#

Some people turn off animation in their system settings. Respect that with a media query. MDN recommends keeping the layout the same and removing or softening movement, so here the sphere stops moving and the glow fades more slowly.

@media (prefers-reduced-motion: reduce) {
  .orb,
  .orb::after { animation: none; }
  .orb::before { animation-duration: 4s; }
}

The loader still reads as "working" through the soft glow, but nothing spins or scales.

Make it yours#

  • Size: change --size. Everything else, including the glow, scales with it.
  • Colour: swap the three blues in the sphere gradient and the rgb(90 120 255 / ...) in the glow. Keep the lightest stop near the top left so the sphere still looks lit from one side.
  • Speed: a breathing cycle of 2 to 3 seconds feels calm. Under a second starts to feel anxious.
  • Placement: put the orb where the reply will appear, so it is replaced by the content instead of sitting next to it.

When you want a ready-made orb#

If you would rather tune an orb than hand-write it, HorizonX has orb editors. Generating Orb is the pure CSS editor built for a generating state. If you need ray-traced WebGL orbs instead of plain CSS, open Orbs Studio, browse presets in the AI orbs collection, or see other spinners in the CSS loaders collection.

How this was checked#

I rendered the snippet in Chromium through the remote browser tool and saved a screenshot of the result. The orb, glow and sweep were visible, and the computed styles showed the three animations running. For reduced motion I forced the rule on in a second test page, where the computed animation names were none for the orb and the sweep, and the glow ran at the slower 4 s speed. I did not toggle the operating system setting itself, and I did not test Safari or Firefox.

Next step#

Open the editor, tune the colours and speed, and copy the result: Try the orb editor.