Layout blueprint
Frosted glass sound modal
A dark frosted glassmorphism modal with heavy backdrop blur, saturated ambient color bleed, a crisp top-edge specular rim, rotating music-box cylinder, and minimal audio sliders.
Inspired by Daniil Ch. (@daniildesigns) on X ↗
Build it
Choose a target and adapt the source to your interface.
<div class="glass-stage">
<button
class="glass-trigger"
type="button"
aria-expanded="true"
aria-controls="glass-sound-modal"
hidden
>
Sound settings
</button>
<section
class="glass-modal"
id="glass-sound-modal"
role="dialog"
aria-label="Sound settings"
>
<div class="glass-sheen" aria-hidden="true"></div>
<div class="glass-head">
<h2>Sound settings</h2>
<button
class="glass-icon-btn glass-close"
type="button"
aria-label="Close sound settings"
>
<svg viewBox="0 0 14 14" aria-hidden="true">
<path d="M3 3l8 8M11 3l-8 8" />
</svg>
</button>
</div>
<div class="glass-cylinder-wrap">
<canvas
class="glass-cylinder"
width="264"
height="102"
aria-hidden="true"
></canvas>
</div>
<div class="glass-track-row">
<button
class="glass-icon-btn glass-prev"
type="button"
aria-label="Previous track"
>
<svg viewBox="0 0 14 14" aria-hidden="true">
<path d="M8.5 3.5 5 7l3.5 3.5" />
</svg>
</button>
<div class="glass-track-meta">
<div class="glass-track-title">Slow Clouds</div>
<div class="glass-track-sub">after Debussy</div>
</div>
<button
class="glass-icon-btn glass-next"
type="button"
aria-label="Next track"
>
<svg viewBox="0 0 14 14" aria-hidden="true">
<path d="M5.5 3.5 9 7l-3.5 3.5" />
</svg>
</button>
</div>
<div class="glass-sliders">
<div class="glass-row">
<label for="glass-music">Music</label
><input
id="glass-music"
class="glass-slider"
type="range"
min="0"
max="100"
value="55"
style="--val: 55%"
/><span>55%</span>
</div>
<div class="glass-row">
<label for="glass-nature">Nature</label
><input
id="glass-nature"
class="glass-slider"
type="range"
min="0"
max="100"
value="35"
style="--val: 35%"
/><span>35%</span>
</div>
<div class="glass-row">
<label for="glass-water">Water</label
><input
id="glass-water"
class="glass-slider"
type="range"
min="0"
max="100"
value="20"
style="--val: 20%"
/><span>20%</span>
</div>
<div class="glass-row">
<label for="glass-effects">Effects</label
><input
id="glass-effects"
class="glass-slider"
type="range"
min="0"
max="100"
value="60"
style="--val: 60%"
/><span>60%</span>
</div>
</div>
</section>
</div>
<script>
const stage = document.querySelector('.glass-stage');
const modal = stage.querySelector('.glass-modal');
const trigger = stage.querySelector('.glass-trigger');
const closeBtn = stage.querySelector('.glass-close');
const titleEl = stage.querySelector('.glass-track-title');
const subEl = stage.querySelector('.glass-track-sub');
const trackMeta = stage.querySelector('.glass-track-meta');
const reduced = matchMedia('(prefers-reduced-motion:reduce)');
const tracks = [
{ title: 'Slow Clouds', sub: 'after Debussy' },
{ title: 'Quiet Pond', sub: 'after Satie' },
{ title: 'Evening Dew', sub: 'after Ravel' },
];
let open = true,
index = 0,
modalAnim,
triggerAnim;
function setOpen(next) {
open = next;
modalAnim?.cancel();
triggerAnim?.cancel();
trigger.setAttribute('aria-expanded', String(open));
if (reduced.matches) {
modal.hidden = !open;
trigger.hidden = open;
(open ? closeBtn : trigger).focus({ preventScroll: true });
return;
}
const ease = 'cubic-bezier(.22,1,.36,1)';
if (open) {
trigger.hidden = true;
modal.hidden = false;
closeBtn.focus({ preventScroll: true });
modalAnim = modal.animate(
[
{ opacity: 0, transform: 'translateY(12px) scale(.96)' },
{ opacity: 1, transform: 'translateY(0) scale(1)' },
],
{ duration: 360, easing: ease, fill: 'both' },
);
modalAnim.finished
.then(() => {
modalAnim?.cancel();
modalAnim = null;
})
.catch(() => {});
} else {
trigger.hidden = false;
trigger.focus({ preventScroll: true });
modalAnim = modal.animate(
[
{ opacity: 1, transform: 'translateY(0) scale(1)' },
{ opacity: 0, transform: 'translateY(10px) scale(.96)' },
],
{ duration: 260, easing: ease, fill: 'both' },
);
triggerAnim = trigger.animate(
[
{ opacity: 0, transform: 'translateY(8px) scale(.95)' },
{ opacity: 1, transform: 'translateY(0) scale(1)' },
],
{ duration: 240, delay: 80, easing: ease, fill: 'both' },
);
modalAnim.finished
.then(() => {
if (!open) modal.hidden = true;
modalAnim?.cancel();
modalAnim = null;
})
.catch(() => {});
triggerAnim.finished
.then(() => {
triggerAnim?.cancel();
triggerAnim = null;
})
.catch(() => {});
}
}
closeBtn.addEventListener('click', () => setOpen(false));
trigger.addEventListener('click', () => setOpen(true));
stage.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && open) {
event.preventDefault();
setOpen(false);
}
});
function stepTrack(delta) {
index = (index + delta + tracks.length) % tracks.length;
titleEl.textContent = tracks[index].title;
subEl.textContent = tracks[index].sub;
if (!reduced.matches)
trackMeta.animate(
[
{ opacity: 0, transform: 'translateX(' + delta * 8 + 'px)' },
{ opacity: 1, transform: 'translateX(0)' },
],
{ duration: 220, easing: 'cubic-bezier(.22,1,.36,1)' },
);
}
stage
.querySelector('.glass-prev')
.addEventListener('click', () => stepTrack(-1));
stage
.querySelector('.glass-next')
.addEventListener('click', () => stepTrack(1));
stage.querySelectorAll('.glass-slider').forEach((input) => {
const readout = input.nextElementSibling;
input.addEventListener('input', () => {
input.style.setProperty('--val', input.value + '%');
readout.textContent = input.value + '%';
});
});
const canvas = stage.querySelector('.glass-cylinder');
const ctx = canvas.getContext('2d');
const dpr = window.devicePixelRatio || 1;
canvas.width = 264 * dpr;
canvas.height = 102 * dpr;
ctx.scale(dpr, dpr);
const pins = Array.from({ length: 38 }, (_, i) => ({
x: 36 + ((i * 49) % 192),
angle: (i * 0.72) % (Math.PI * 2),
}));
let phase = 0.4;
function drawCylinder() {
ctx.clearRect(0, 0, 264, 102);
const cx = 132,
cy = 51,
halfW = 106,
rx = 11,
ry = 40;
const grad = ctx.createLinearGradient(0, cy - ry, 0, cy + ry);
grad.addColorStop(0, 'rgba(255,255,255,.22)');
grad.addColorStop(0.18, 'rgba(255,255,255,.07)');
grad.addColorStop(0.5, 'rgba(255,255,255,.03)');
grad.addColorStop(0.84, 'rgba(255,255,255,.08)');
grad.addColorStop(1, 'rgba(255,255,255,.24)');
ctx.beginPath();
ctx.ellipse(cx - halfW, cy, rx, ry, 0, Math.PI * 0.5, Math.PI * 1.5);
ctx.lineTo(cx + halfW, cy - ry);
ctx.ellipse(cx + halfW, cy, rx, ry, 0, -Math.PI * 0.5, Math.PI * 0.5);
ctx.closePath();
ctx.fillStyle = grad;
ctx.fill();
ctx.strokeStyle = 'rgba(255,255,255,.07)';
ctx.lineWidth = 0.75;
for (let x = cx - halfW + 14; x < cx + halfW; x += 13) {
ctx.beginPath();
ctx.moveTo(x, cy - ry);
ctx.lineTo(x, cy + ry);
ctx.stroke();
}
for (const p of pins) {
const a = p.angle + phase,
y = cy + Math.sin(a) * (ry - 4),
d = Math.cos(a),
alpha = d > 0 ? 0.35 + d * 0.65 : 0.12 + (d + 1) * 0.1;
ctx.fillStyle = 'rgba(255,255,255,' + alpha.toFixed(2) + ')';
ctx.fillRect(p.x, y - 1.5, 2.5, 3);
}
ctx.strokeStyle = 'rgba(255,255,255,.22)';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(cx - halfW - 12, cy);
ctx.lineTo(cx + halfW + 12, cy);
ctx.stroke();
ctx.strokeStyle = 'rgba(255,255,255,.46)';
ctx.lineWidth = 1.1;
ctx.beginPath();
ctx.moveTo(cx - halfW, cy - ry);
ctx.lineTo(cx + halfW, cy - ry);
ctx.moveTo(cx - halfW, cy + ry);
ctx.lineTo(cx + halfW, cy + ry);
ctx.stroke();
ctx.strokeStyle = 'rgba(255,255,255,.32)';
ctx.beginPath();
ctx.ellipse(cx - halfW, cy, rx, ry, 0, 0, Math.PI * 2);
ctx.stroke();
ctx.beginPath();
ctx.ellipse(cx + halfW, cy, rx, ry, 0, 0, Math.PI * 2);
ctx.stroke();
if (!reduced.matches) {
phase += 0.008;
requestAnimationFrame(drawCylinder);
}
}
drawCylinder();
</script>
<style>
.glass-stage {
position: relative;
width: 360px;
max-width: 100%;
height: 440px;
display: grid;
place-items: center;
padding: 18px;
overflow: hidden;
border-radius: 16px;
background-color: #162221;
background-image:
radial-gradient(
circle at 22% 18%,
rgba(45, 96, 74, 0.88) 0%,
transparent 44%
),
radial-gradient(
circle at 78% 22%,
rgba(36, 74, 68, 0.84) 0%,
transparent 46%
),
radial-gradient(
circle at 64% 46%,
rgba(84, 152, 165, 0.55) 0%,
transparent 34%
),
radial-gradient(
circle at 82% 76%,
rgba(196, 118, 58, 0.82) 0%,
transparent 40%
),
radial-gradient(
circle at 18% 78%,
rgba(164, 96, 52, 0.72) 0%,
transparent 42%
),
radial-gradient(
circle at 48% 86%,
rgba(92, 68, 48, 0.74) 0%,
transparent 46%
),
repeating-linear-gradient(
0deg,
rgba(255, 255, 255, 0.025) 0,
rgba(255, 255, 255, 0.025) 2px,
transparent 2px,
transparent 6px
),
repeating-linear-gradient(
90deg,
rgba(0, 0, 0, 0.06) 0,
rgba(0, 0, 0, 0.06) 2px,
transparent 2px,
transparent 6px
);
color: rgba(255, 255, 255, 0.92);
font:
14px/1.4 system-ui,
-apple-system,
sans-serif;
isolation: isolate;
}
.glass-trigger {
position: absolute;
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 0 18px;
border: 1px solid rgba(255, 255, 255, 0.24);
border-radius: 999px;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.14),
rgba(18, 22, 22, 0.48)
);
backdrop-filter: blur(20px) saturate(160%);
-webkit-backdrop-filter: blur(20px) saturate(160%);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.3),
0 14px 32px rgba(0, 0, 0, 0.42);
color: rgba(255, 255, 255, 0.92);
font:
500 13px/1 system-ui,
sans-serif;
cursor: pointer;
}
.glass-trigger[hidden],
.glass-modal[hidden] {
display: none;
}
.glass-trigger:focus-visible,
.glass-modal button:focus-visible,
.glass-slider:focus-visible {
outline: 2px solid rgba(255, 255, 255, 0.85);
outline-offset: 2px;
}
.glass-modal {
position: relative;
width: 100%;
max-width: 308px;
padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.24);
border-radius: 22px;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.13) 0%,
rgba(23, 23, 23, 0.38) 48%,
rgba(10, 10, 10, 0.52) 100%
);
backdrop-filter: blur(24px) saturate(160%);
-webkit-backdrop-filter: blur(24px) saturate(160%);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.32),
inset 0 -1px 0 rgba(255, 255, 255, 0.06),
0 28px 64px rgba(0, 0, 0, 0.52);
color: rgba(255, 255, 255, 0.92);
overflow: hidden;
}
.glass-sheen {
position: absolute;
inset: 0 0 auto 0;
height: 88px;
border-radius: 22px 22px 0 0;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent);
pointer-events: none;
}
.glass-head {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
}
.glass-head h2 {
margin: 0;
font-size: 15px;
font-weight: 500;
letter-spacing: -0.01em;
color: rgba(255, 255, 255, 0.96);
}
.glass-icon-btn {
display: grid;
place-items: center;
width: 28px;
height: 28px;
padding: 0;
border: 0;
border-radius: 999px;
background: transparent;
color: rgba(255, 255, 255, 0.65);
cursor: pointer;
transition:
background-color 140ms ease,
color 140ms ease;
}
.glass-icon-btn:hover {
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.96);
}
.glass-icon-btn svg {
width: 14px;
height: 14px;
fill: none;
stroke: currentColor;
stroke-width: 1.6;
stroke-linecap: round;
stroke-linejoin: round;
}
.glass-cylinder-wrap {
position: relative;
display: flex;
justify-content: center;
margin: 14px 0 12px;
}
.glass-cylinder {
width: 264px;
height: 102px;
display: block;
}
.glass-track-row {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 18px;
}
.glass-track-meta {
text-align: center;
}
.glass-track-title {
font-size: 14px;
font-weight: 500;
letter-spacing: -0.01em;
color: rgba(255, 255, 255, 0.96);
}
.glass-track-sub {
margin-top: 2px;
font-size: 11px;
color: rgba(255, 255, 255, 0.5);
}
.glass-sliders {
position: relative;
display: grid;
gap: 13px;
}
.glass-row {
display: grid;
grid-template-columns: 54px 1fr 32px;
align-items: center;
gap: 10px;
}
.glass-row label {
font-size: 12px;
color: rgba(255, 255, 255, 0.66);
}
.glass-row span {
text-align: right;
font-size: 11px;
font-variant-numeric: tabular-nums;
color: rgba(255, 255, 255, 0.56);
}
.glass-slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 18px;
background: transparent;
cursor: pointer;
}
.glass-slider::-webkit-slider-runnable-track {
height: 2px;
border-radius: 999px;
background: linear-gradient(
to right,
rgba(255, 255, 255, 0.86) 0%,
rgba(255, 255, 255, 0.86) var(--val, 50%),
rgba(255, 255, 255, 0.22) var(--val, 50%),
rgba(255, 255, 255, 0.22) 100%
);
}
.glass-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 12px;
margin-top: -5px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.96);
box-shadow:
0 1px 6px rgba(0, 0, 0, 0.45),
0 0 0 1px rgba(255, 255, 255, 0.3);
transition: transform 120ms ease;
}
.glass-slider::-webkit-slider-thumb:hover {
transform: scale(1.14);
}
.glass-slider::-moz-range-track {
height: 2px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.22);
}
.glass-slider::-moz-range-progress {
height: 2px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.86);
}
.glass-slider::-moz-range-thumb {
width: 12px;
height: 12px;
border: 0;
border-radius: 999px;
background: rgba(255, 255, 255, 0.96);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
@media (prefers-reduced-motion: reduce) {
.glass-modal,
.glass-trigger,
.glass-icon-btn,
.glass-slider::-webkit-slider-thumb {
animation: none;
transition: none;
}
}
</style>Animation breakdown
Frame phases, motion intent, implementation constraints and accessible alternatives.
Rest: dark frosted glass modal sits centered over the scene with a 24px backdrop blur, 160% saturation bleed, specular top-edge highlight, and a gently rotating music-box cylinder. Dismiss (0–260ms): modal settles 10px down, scales to 0.96, and fades out while the frosted trigger pill fades up from 8px below (80–320ms). Reopen (0–360ms): modal rises 12px from 0.96 scale into full opacity with ease-out.
Motion intent
A dark frosted glassmorphism modal with heavy backdrop blur, saturated ambient color bleed, a crisp top-edge specular rim, rotating music-box cylinder, and minimal audio sliders.
260ms dismisses the modal briskly while overlapping the trigger pill reveal at 80ms; 360ms gives the returning frosted pane a calm, buoyant arrival.
A smooth ease-out curve lets the translucent glass settle cleanly without rubbery overshoot.
Motion specification
- Trigger
- Close the modal or press Escape to collapse it into the frosted Sound settings pill; click the pill to bring it back. Switch tracks or drag the sliders inside.
- Timing
- 360ms
- Easing
- cubic-bezier(.22, 1, .36, 1)
Animated properties
Implementation notes
- Layer backdrop-filter: blur(24px) saturate(160%) with a smoky vertical gradient so vibrant background colors bleed softly through without hurting text contrast.
- Combine a 1px rgba(255, 255, 255, 0.24) border with an inset 0 1px 0 rgba(255, 255, 255, 0.32) highlight and subtle top sheen to simulate overhead light catching a beveled glass edge.
- Keep dismiss and reveal animations on transform and opacity so the heavy backdrop-filter layer stays smooth on the compositor.
- Pause the rotating music-box cylinder canvas and skip entrance/exit transitions when prefers-reduced-motion: reduce is active.
Reduced motion
Toggle modal and trigger visibility immediately and render the music-box cylinder statically.
- Expose role="dialog" with aria-label on the modal and aria-expanded/aria-controls on the trigger button.
- Support Escape to close the modal and return keyboard focus between the close button and trigger pill.
- Label every range slider and icon button clearly for screen readers and keyboard users.
Avoid
- Do not animate backdrop-filter blur radius frame-by-frame during large dialog transitions if frame drops appear on lower-end GPUs.
- Do not use pure opaque dark fills that block ambient color bleed from the scene behind the glass.