Popular Animation — Reference
Shimmer Button
The Shimmer Button is a CSS animation component that a call-to-action button wrapped in an animated conic gradient shimmer with a highlight sweep. Ideal for primary actions, pricing CTAs, or any button that needs to stand out and draw the user's eye. It ships as self-contained HTML and CSS with no external dependencies, making it drop-in ready for any modern web project regardless of framework or build system.
When to use the Shimmer Button
- Primary and secondary CTA interaction feedback
- Landing page hero backgrounds and section dividers
- Product cards, navigation items, and link interactions
- Component libraries and design systems that need consistent motion patterns
- Progressive enhancement — works in all modern browsers, degrades gracefully
Performance characteristics
- GPU-accelerated — uses CSS transform and opacity so compositing happens off the main thread
- Zero JavaScript dependency in most configurations — no framework, no bundler required
- Approximately 60 fps on any device that supports CSS animations (Chrome 43+, Firefox 16+, Safari 9+)
- Self-contained in a single HTML file — no npm install, no build step, paste and ship
How it compares
Unlike equivalent JavaScript implementations, the Shimmer Button does not require any runtime library — there is nothing to install, bundle, or load asynchronously.
Compared to animated GIFs or video embeds, this CSS component is resolution-independent, theme-able via CSS custom properties, and weighs a fraction of the equivalent media file.
Source code
CSS
:root {
--spread: 90deg;
--shimmer-color: #ffffff;
--radius: 100px;
--speed: 3s;
--cut: 0.05em;
--bg: #0a0a0a;
}
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0a0a0a; }
.btn {
position: relative;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 12px 24px;
color: white;
background: var(--bg);
border: 1px solid rgba(255,255,255,0.1);
border-radius: var(--radius);
font-family: system-ui, sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: transform 0.3s ease;
}
.btn:active { transform: translateY(1px); }
.btn .spark-wrap {
position: absolute;
inset: 0;
z-index: -30;
overflow: visible;
filter: blur(2px);
}
.btn .spark {
position: absolute;
inset: 0;
aspect-ratio: 1;
animation: shimmer-slide var(--speed) linear infinite;
}
.btn .spark::before {
content: "";
position: absolute;
inset: -100%;
background: conic-gradient(from calc(270deg - (var(--spread) * 0.5)), transparent 0, var(--shimmer-color) var(--spread), transparent var(--spread));
animation: spin-around var(--speed) linear infinite;
}
.btn .highlight {
position: absolute;
inset: 0;
border-radius: var(--radius);
box-shadow: inset 0 -8px 10px rgba(255,255,255,0.12);
transition: box-shadow 0.3s ease;
pointer-events: none;
}
.btn:hover .highlight { box-shadow: inset 0 -6px 10px rgba(255,255,255,0.25); }
.btn:active .highlight { box-shadow: inset 0 -10px 10px rgba(255,255,255,0.25); }
.btn .backdrop {
position: absolute;
inset: var(--cut);
z-index: -20;
background: var(--bg);
border-radius: var(--radius);
}
@keyframes shimmer-slide { to { transform: translateX(100%); } }
@keyframes spin-around { to { transform: rotate(360deg); } }HTML
<button type="button" class="btn">
<div class="spark-wrap"><div class="spark"></div></div>
<div class="highlight"></div>
<div class="backdrop"></div>
</button>Full source
<!DOCTYPE html>
<html>
<head>
<style>
:root {
--spread: 90deg;
--shimmer-color: #ffffff;
--radius: 100px;
--speed: 3s;
--cut: 0.05em;
--bg: #0a0a0a;
}
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0a0a0a; }
.btn {
position: relative;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 12px 24px;
color: white;
background: var(--bg);
border: 1px solid rgba(255,255,255,0.1);
border-radius: var(--radius);
font-family: system-ui, sans-serif;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: transform 0.3s ease;
}
.btn:active { transform: translateY(1px); }
.btn .spark-wrap {
position: absolute;
inset: 0;
z-index: -30;
overflow: visible;
filter: blur(2px);
}
.btn .spark {
position: absolute;
inset: 0;
aspect-ratio: 1;
animation: shimmer-slide var(--speed) linear infinite;
}
.btn .spark::before {
content: "";
position: absolute;
inset: -100%;
background: conic-gradient(from calc(270deg - (var(--spread) * 0.5)), transparent 0, var(--shimmer-color) var(--spread), transparent var(--spread));
animation: spin-around var(--speed) linear infinite;
}
.btn .highlight {
position: absolute;
inset: 0;
border-radius: var(--radius);
box-shadow: inset 0 -8px 10px rgba(255,255,255,0.12);
transition: box-shadow 0.3s ease;
pointer-events: none;
}
.btn:hover .highlight { box-shadow: inset 0 -6px 10px rgba(255,255,255,0.25); }
.btn:active .highlight { box-shadow: inset 0 -10px 10px rgba(255,255,255,0.25); }
.btn .backdrop {
position: absolute;
inset: var(--cut);
z-index: -20;
background: var(--bg);
border-radius: var(--radius);
}
@keyframes shimmer-slide { to { transform: translateX(100%); } }
@keyframes spin-around { to { transform: rotate(360deg); } }
</style>
</head>
<body>
<button type="button" class="btn">
<div class="spark-wrap"><div class="spark"></div></div>
<div class="highlight"></div>
<div class="backdrop"></div>
</button>
</body>
</html>Frequently asked questions
How do I add the Shimmer Button to my project?
Copy the full source code from the code block on this page. Paste the <style> block into your stylesheet (or a <style> tag in your HTML head) and the HTML markup into your template. No npm install or build step is required — the animation is self-contained. To customize colors, speed, or size, use Grepped's workspace at grepped.dev/animations/popular/shimmer-button.
Is the Shimmer Button free to use?
Yes. All Grepped preset animations are free to use in personal and commercial projects. You may copy, modify, and redistribute the code without attribution. The only limitation is that you may not resell the presets themselves as part of a competing animation library.
Does the Shimmer Button work on mobile browsers?
Yes. The Shimmer Button uses standard CSS animations and transforms that are supported in all modern mobile browsers — Chrome for Android, Safari on iOS 9+, Samsung Internet, and Firefox for Android. Where JavaScript is used for interactivity (e.g. cursor effects), it falls back gracefully on touch devices.
Can I customize the Shimmer Button's colors, speed, or size?
Yes. Open the live customization workspace at grepped.dev/animations/popular/shimmer-button to adjust the animation with real-time sliders, color pickers, and toggles — no code required. For deeper changes, the source code uses CSS custom properties (variables) so you can edit them directly in your stylesheet.
Want to customize this animation or generate a new one from a text prompt?
Open in Workspace — it's free