CSS Button Animations: Sonar Pulses, Shimmers & Border Laser Beams
Modern CSS button animations elevate conversion rates through tactile micro-interactions. Create concentric sonar pulses by expanding pseudo-elements with animation: pulse 2s infinite and box-shadow: 0 0 0 0 rgba(var(--accent), 0.7). Build orbiting border laser beams using conic-gradient() with CSS @property --angle rotation, and add cosmic shimmers using angled linear gradients translating across the button face.
Step 1: Concentric Sonar Radar Pulses with Box-Shadows
Sonar radar pulses draw immediate user attention to high-value CTA buttons without annoying shaking. Animate box-shadow expansion and fadeout on a continuous loop.
.btn-sonar {
position: relative;
background: var(--accent);
color: #ffffff;
border-radius: 9999px;
animation: sonarWave 2.2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}
@keyframes sonarWave {
0% {
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.75);
}
70% {
box-shadow: 0 0 0 14px rgba(99, 102, 241, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
}
}
Step 2: Orbiting Border Laser Beams via @property & conic-gradient
The border beam effect creates a laser light traveling endlessly around the button perimeter. Modern CSS registers a custom property angle and animates it around a conic-gradient border mask.
@property --beam-angle {
syntax: '<angle>';
initial-value: 0deg;
inherits: false;
}
.btn-border-beam {
position: relative;
border-radius: 12px;
background: #0f172a;
}
.btn-border-beam::before {
content: '';
position: absolute;
inset: -1.5px;
border-radius: inherit;
background: conic-gradient(from var(--beam-angle), transparent 75%, #6366f1 90%, #ec4899 100%);
animation: rotateBeam 3s linear infinite;
z-index: -1;
}
@keyframes rotateBeam {
to { --beam-angle: 360deg; }
}
Step 3: Cosmic Starlight Shimmers on Hover
Create a luxurious glint effect by sweeping an angled semi-transparent white gradient across the button face when hovered.
.btn-shimmer {
position: relative;
overflow: hidden;
}
.btn-shimmer::after {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
60deg,
transparent 40%,
rgba(255, 255, 255, 0.35) 50%,
transparent 60%
);
transform: translateX(-100%);
transition: transform 0.6s ease;
}
.btn-shimmer:hover::after {
transform: translateX(100%);
}
Step 4: Tactile Click Depress & Spring Resistance
Buttons should physically react to user clicks. Use :active to slightly compress the button (transform: scale(0.97) translateY(1px)), simulating spring resistance.
.btn-interactive {
transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn-interactive:active {
transform: scale(0.96) translateY(2px);
}
Next-Level Addons: Elevating Your Implementation
Take this technique further by combining it with complementary design token studios and animation tools:
When building high-performance UI animations or particle systems, my golden rule is: never calculate layout triggers (like getBoundingClientRect() or offsetHeight) inside animation loops. Read measurements once upfront and use CSS transforms or Canvas for buttery 60fps.
Frequently Asked Questions
Practical answers to common implementation questions, browser quirks, and performance tips.
Why should I use @property for rotating conic gradient border beams?
Browsers cannot natively interpolate angle values inside `conic-gradient()` strings. Declaring `@property --beam-angle { syntax: "
Do continuous button animations harm battery life on mobile devices?
Animations driven by `box-shadow` or `transform` on the GPU consume minimal power. However, it is best practice to pause intense animations when the user is not actively interacting, or disable them under `@media (prefers-reduced-motion: reduce)`.
How do I ensure animated buttons remain accessible for screen readers?
Keep the internal HTML clean: use a standard `
What is the optimal animation duration for button hover shimmers?
A shimmer duration between `0.5s` and `0.8s` feels snappy and responsive. Anything longer than 1 second feels sluggish to the user.
Can button animations be combined with native HTML form submissions?
Yes! All animations discussed run entirely in CSS and do not intercept or block native `