# Newton's Cradle Loader

> A Newton's cradle where the outer balls swing out and knock the row in turn.

- Category: [CSS Loaders & Spinners](https://copy-css.com/category/loaders)
- Tags: pendulum, swing, physics, balls, desk toy
- Live preview: https://copy-css.com/snippets/newtons-cradle-loader
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="loader-cradle" role="status" aria-label="Loading">
  <span></span><span></span><span></span><span></span>
</div>
```

## CSS

```css
.loader-cradle {
  display: flex;
  border-top: 2px solid #94a3b8;
}

.loader-cradle span {
  position: relative;
  width: 18px;
  height: 56px;
  transform-origin: 50% 0;
}

/* String */
.loader-cradle span::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 40px;
  background: #94a3b8;
}

/* Ball */
.loader-cradle span::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #94a3b8, #334155 60%);
}

.loader-cradle span:first-child {
  animation: loader-cradle-left 1.2s infinite;
}

.loader-cradle span:last-child {
  animation: loader-cradle-right 1.2s infinite;
}

@keyframes loader-cradle-left {
  0% { transform: rotate(0); animation-timing-function: ease-out; }
  25% { transform: rotate(35deg); animation-timing-function: ease-in; }
  50%, 100% { transform: rotate(0); }
}

@keyframes loader-cradle-right {
  0%, 50% { transform: rotate(0); animation-timing-function: ease-out; }
  75% { transform: rotate(-35deg); animation-timing-function: ease-in; }
  100% { transform: rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .loader-cradle span:first-child,
  .loader-cradle span:last-child { animation-duration: 3s; }
}
```

## Notes

- This CSS Newton's Cradle Loader is 59 lines of pure CSS (1.3 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms, radial gradients and Flexbox.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
