CSS Newton's Cradle Loader
A Newton's cradle where the outer balls swing out and knock the row in turn.
<div class="loader-cradle" role="status" aria-label="Loading">
<span></span><span></span><span></span><span></span>
</div>
.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; }
}
About this CSS Newton's Cradle Loader
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. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#94a3b8#334155
How to use this newton's cradle loader
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.loader-cradleclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.