Music player
A full now-playing screen: cover art drawn in code tints the whole screen, the waveform is the scrubber, and the cover shrinks back when paused.
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type KeyboardEvent,
type PointerEvent,
} from "react";
import "./music-player.css";
export type Track = {
title: string;
artist: string;
album: string;
/** Length in seconds. */
length: number;
/** Three colors that paint the cover art and tint the whole screen. */
colors: [string, string, string];
};
type MusicPlayerProps = { tracks: Track[] };
const BARS = 54;
/** A waveform that looks hand-recorded: the same track always gets the same shape. */
function wave(seed: number) {
return Array.from({ length: BARS }, (_, i) => {
const x = i / BARS;
const v =
0.45 +
0.3 * Math.sin(x * 9 + seed) +
0.2 * Math.sin(x * 23 + seed * 2.3) +
0.12 * Math.sin(x * 51 + seed * 0.7);
return Math.max(
0.12,
Math.min(1, v * (0.55 + 0.45 * Math.sin(x * Math.PI))),
);
});
}
const time = (s: number) =>
`${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
/**
* MusicPlayer: a full "now playing" screen.
* - The cover art is drawn in code from three colors, and the same colors
* wash over the whole screen, so every track has its own mood.
* - The waveform is the progress bar: tap or drag it to jump, or use the arrow keys.
* - The cover shrinks back when paused, and the next track starts by itself.
*/
export function MusicPlayer({ tracks }: MusicPlayerProps) {
const [index, setIndex] = useState(0);
const [playing, setPlaying] = useState(true);
const [t, setT] = useState(38);
const [liked, setLiked] = useState<Set<number>>(new Set([0]));
const [shuffle, setShuffle] = useState(false);
const [repeat, setRepeat] = useState(false);
const bar = useRef<HTMLDivElement>(null);
const seeking = useRef(false);
const track = tracks[index];
const next = tracks[(index + 1) % tracks.length];
const bars = wave(index * 1.7 + 0.4);
const p = Math.min(1, t / track.length);
const go = (dir: 1 | -1) => {
// "Back" restarts the song first, like every music app.
if (dir === -1 && t > 3) return setT(0);
setIndex((i) => (i + dir + tracks.length) % tracks.length);
setT(0);
};
// The clock reads the latest values from a ref, so it never restarts.
const live = useRef({ t, length: track.length, repeat });
useEffect(() => {
live.current = { t, length: track.length, repeat };
});
// A quarter-second clock while playing; at the end, move on (or repeat).
useEffect(() => {
if (!playing) return;
const id = window.setInterval(() => {
if (seeking.current) return;
const now = live.current;
if (now.t + 0.25 < now.length) return setT(now.t + 0.25);
if (!now.repeat) setIndex((i) => (i + 1) % tracks.length);
setT(0);
}, 250);
return () => window.clearInterval(id);
}, [playing, tracks.length]);
const seekTo = (clientX: number) => {
const r = bar.current?.getBoundingClientRect();
if (!r) return;
const k = Math.min(1, Math.max(0, (clientX - r.left) / r.width));
setT(k * track.length);
};
const down = (e: PointerEvent<HTMLDivElement>) => {
e.currentTarget.setPointerCapture(e.pointerId);
seeking.current = true;
e.currentTarget.dataset.seeking = "";
seekTo(e.clientX);
};
const move = (e: PointerEvent<HTMLDivElement>) => {
if (seeking.current) seekTo(e.clientX);
};
const up = (e: PointerEvent<HTMLDivElement>) => {
seeking.current = false;
delete e.currentTarget.dataset.seeking;
};
const keys = (e: KeyboardEvent<HTMLDivElement>) => {
if (e.key === "ArrowRight") setT((s) => Math.min(track.length - 1, s + 5));
else if (e.key === "ArrowLeft") setT((s) => Math.max(0, s - 5));
else return;
e.preventDefault();
};
const toggleLike = () =>
setLiked((set) => {
const copy = new Set(set);
if (copy.has(index)) copy.delete(index);
else copy.add(index);
return copy;
});
const [a, b, c] = track.colors;
const art = { "--a": a, "--b": b, "--c": c } as CSSProperties;
return (
<div className="gu-music" style={art} data-playing={playing}>
{/* The cover's colors, blown up and blurred, as the screen's backdrop. */}
<div className="gu-music__wash" aria-hidden="true" />
<header className="gu-music__top">
<button
type="button"
className="gu-music__icon"
aria-label="Close player"
>
<svg viewBox="0 0 24 24">
<path d="m6 9 6 6 6-6" />
</svg>
</button>
<p className="gu-music__from">
<span>Playing from album</span>
<strong>{track.album}</strong>
</p>
<button
type="button"
className="gu-music__icon"
aria-label="More options"
>
<svg viewBox="0 0 24 24">
<path d="M5 12h.01M12 12h.01M19 12h.01" />
</svg>
</button>
</header>
<div className="gu-music__art-wrap">
<div
className="gu-music__art"
key={index}
role="img"
aria-label={`Cover of ${track.album}`}
>
<span className="gu-music__sun" />
<span className="gu-music__hill" />
<span className="gu-music__hill gu-music__hill--2" />
<span className="gu-music__grain" />
</div>
</div>
<div className="gu-music__meta">
<div>
<h2 className="gu-music__title">{track.title}</h2>
<p className="gu-music__artist">{track.artist}</p>
</div>
<button
type="button"
className="gu-music__like"
aria-pressed={liked.has(index)}
aria-label={
liked.has(index) ? "Remove from liked songs" : "Add to liked songs"
}
onClick={toggleLike}
>
<svg viewBox="0 0 24 24">
<path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10Z" />
</svg>
</button>
</div>
{/* The waveform is the scrubber. */}
<div
ref={bar}
className="gu-music__wave"
role="slider"
tabIndex={0}
aria-label="Song position"
aria-valuemin={0}
aria-valuemax={Math.round(track.length)}
aria-valuenow={Math.round(t)}
aria-valuetext={`${time(t)} of ${time(track.length)}`}
style={{ "--p": p } as CSSProperties}
onPointerDown={down}
onPointerMove={move}
onPointerUp={up}
onPointerCancel={up}
onKeyDown={keys}
>
{[0, 1].map((layer) => (
<span
key={layer}
className={`gu-music__bars ${layer ? "is-played" : ""}`}
aria-hidden="true"
>
{bars.map((h, i) => (
<span key={i} style={{ height: `${h * 100}%` }} />
))}
</span>
))}
</div>
<div className="gu-music__times" aria-hidden="true">
<span>{time(t)}</span>
<span>-{time(Math.max(0, track.length - t))}</span>
</div>
<div className="gu-music__controls">
<button
type="button"
className="gu-music__icon gu-music__toggle"
aria-label="Shuffle"
aria-pressed={shuffle}
onClick={() => setShuffle((v) => !v)}
>
<svg viewBox="0 0 24 24">
<path d="M4 7h3c5 0 5 10 10 10h3M4 17h3c1.6 0 2.7-1 3.6-2.4M13.4 9.4C14.3 8 15.4 7 17 7h3M17 4l3 3-3 3M17 14l3 3-3 3" />
</svg>
</button>
<button
type="button"
className="gu-music__icon gu-music__skip"
aria-label="Previous"
onClick={() => go(-1)}
>
<svg viewBox="0 0 24 24">
<path className="fill" d="M18 6v12l-9-6 9-6ZM6 6v12" />
</svg>
</button>
<button
type="button"
className="gu-music__play"
aria-label={playing ? "Pause" : "Play"}
onClick={() => setPlaying((v) => !v)}
>
{playing ? (
<svg viewBox="0 0 24 24">
<path className="fill" d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" />
</svg>
) : (
<svg viewBox="0 0 24 24">
<path className="fill" d="M8 5.5v13l11-6.5-11-6.5Z" />
</svg>
)}
</button>
<button
type="button"
className="gu-music__icon gu-music__skip"
aria-label="Next"
onClick={() => go(1)}
>
<svg viewBox="0 0 24 24">
<path className="fill" d="M6 6v12l9-6-9-6ZM18 6v12" />
</svg>
</button>
<button
type="button"
className="gu-music__icon gu-music__toggle"
aria-label="Repeat this song"
aria-pressed={repeat}
onClick={() => setRepeat((v) => !v)}
>
<svg viewBox="0 0 24 24">
<path d="M5 11V9a3 3 0 0 1 3-3h11l-3-3M19 13v2a3 3 0 0 1-3 3H5l3 3" />
</svg>
</button>
</div>
<button
type="button"
className="gu-music__next"
style={
{
"--a": next.colors[0],
"--b": next.colors[1],
"--c": next.colors[2],
} as CSSProperties
}
onClick={() => go(1)}
>
<span className="gu-music__next-art" aria-hidden="true" />
<span className="gu-music__next-text">
<span>Up next</span>
<strong>
{next.title} · {next.artist}
</strong>
</span>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 7h16M4 12h16M4 17h10" />
</svg>
</button>
<p className="gu-music__sr" aria-live="polite">
{`Now playing ${track.title} by ${track.artist}`}
</p>
</div>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Music player
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A full-screen "now playing" music app screen for phones. Every track paints its own cover art from three colors, and the same colors wash over the whole screen. The waveform is the progress bar.
## Layout and look
- Fills its parent (100% height, min 640px), dark base #0c0c0e, white text, system font (-apple-system, system-ui).
- Respects safe areas: top padding = safe-area-inset-top + 6px, bottom = safe-area-inset-bottom + 14px.
- Backdrop: three large radial gradients in the track's colors, blurred 50px at 75% opacity, darkened by a gradient to #0c0c0e at the bottom.
- Top bar: chevron-down button, "Playing from album" over the album name (centered, 12/14px), and a more button. Icon buttons are 44px circles.
- Cover: square, up to 338px, radius 22px, deep shadow. Drawn in CSS: a vertical gradient of the three colors, a glowing pale sun at 22% from the top, two dark rounded hills at the bottom and an overlay of film grain.
- Title 24px bold, artist 17px at 62% white, a 44px round heart button on the right.
- Waveform: 54 rounded 3px bars, 46px tall area. Two copies: faint (22% white) and bright (white), the bright one clipped with clip-path to the progress.
- Times under it (elapsed and minus remaining), 12px tabular numbers.
- Controls row: shuffle, previous, 76px white play/pause circle, next, repeat. Shuffle and repeat turn lime (#d7ff3a) when on.
- "Up next" pill at the bottom: small cover, label and "title · artist", frosted (backdrop blur 20px).
## Behavior and motion
1. Time advances every 250ms while playing; at the end the next track starts (or the same one with repeat on).
2. Previous restarts the song if more than 3 seconds have played, otherwise goes back a track.
3. Pausing scales the cover to 0.84 with a soft spring (0.7s cubic-bezier(0.16, 1, 0.3, 1)); playing scales it back.
4. Changing track fades and scales the new cover in, and the backdrop colors follow.
5. Tapping the heart fills it with a small pop.
## Touch
Pointer capture on the waveform: tap or drag anywhere on it to scrub (touch-action: none on the waveform only).
## Accessibility
- The waveform is role="slider" with aria-valuetext like "1:12 of 3:34"; Left and Right arrows move 5 seconds.
- Every icon button has a label; shuffle, repeat and like use aria-pressed.
- A visually hidden live region announces "Now playing <title> by <artist>".
- prefers-reduced-motion: no cover scaling or fade, no waveform sweep.
## Props
tracks: { title, artist, album, length (seconds), colors: [string, string, string] }[]
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### MusicPlayer.tsx
```tsx
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type KeyboardEvent,
type PointerEvent,
} from "react";
import "./music-player.css";
export type Track = {
title: string;
artist: string;
album: string;
/** Length in seconds. */
length: number;
/** Three colors that paint the cover art and tint the whole screen. */
colors: [string, string, string];
};
type MusicPlayerProps = { tracks: Track[] };
const BARS = 54;
/** A waveform that looks hand-recorded: the same track always gets the same shape. */
function wave(seed: number) {
return Array.from({ length: BARS }, (_, i) => {
const x = i / BARS;
const v =
0.45 +
0.3 * Math.sin(x * 9 + seed) +
0.2 * Math.sin(x * 23 + seed * 2.3) +
0.12 * Math.sin(x * 51 + seed * 0.7);
return Math.max(
0.12,
Math.min(1, v * (0.55 + 0.45 * Math.sin(x * Math.PI))),
);
});
}
const time = (s: number) =>
`${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
/**
* MusicPlayer: a full "now playing" screen.
* - The cover art is drawn in code from three colors, and the same colors
* wash over the whole screen, so every track has its own mood.
* - The waveform is the progress bar: tap or drag it to jump, or use the arrow keys.
* - The cover shrinks back when paused, and the next track starts by itself.
*/
export function MusicPlayer({ tracks }: MusicPlayerProps) {
const [index, setIndex] = useState(0);
const [playing, setPlaying] = useState(true);
const [t, setT] = useState(38);
const [liked, setLiked] = useState<Set<number>>(new Set([0]));
const [shuffle, setShuffle] = useState(false);
const [repeat, setRepeat] = useState(false);
const bar = useRef<HTMLDivElement>(null);
const seeking = useRef(false);
const track = tracks[index];
const next = tracks[(index + 1) % tracks.length];
const bars = wave(index * 1.7 + 0.4);
const p = Math.min(1, t / track.length);
const go = (dir: 1 | -1) => {
// "Back" restarts the song first, like every music app.
if (dir === -1 && t > 3) return setT(0);
setIndex((i) => (i + dir + tracks.length) % tracks.length);
setT(0);
};
// The clock reads the latest values from a ref, so it never restarts.
const live = useRef({ t, length: track.length, repeat });
useEffect(() => {
live.current = { t, length: track.length, repeat };
});
// A quarter-second clock while playing; at the end, move on (or repeat).
useEffect(() => {
if (!playing) return;
const id = window.setInterval(() => {
if (seeking.current) return;
const now = live.current;
if (now.t + 0.25 < now.length) return setT(now.t + 0.25);
if (!now.repeat) setIndex((i) => (i + 1) % tracks.length);
setT(0);
}, 250);
return () => window.clearInterval(id);
}, [playing, tracks.length]);
const seekTo = (clientX: number) => {
const r = bar.current?.getBoundingClientRect();
if (!r) return;
const k = Math.min(1, Math.max(0, (clientX - r.left) / r.width));
setT(k * track.length);
};
const down = (e: PointerEvent<HTMLDivElement>) => {
e.currentTarget.setPointerCapture(e.pointerId);
seeking.current = true;
e.currentTarget.dataset.seeking = "";
seekTo(e.clientX);
};
const move = (e: PointerEvent<HTMLDivElement>) => {
if (seeking.current) seekTo(e.clientX);
};
const up = (e: PointerEvent<HTMLDivElement>) => {
seeking.current = false;
delete e.currentTarget.dataset.seeking;
};
const keys = (e: KeyboardEvent<HTMLDivElement>) => {
if (e.key === "ArrowRight") setT((s) => Math.min(track.length - 1, s + 5));
else if (e.key === "ArrowLeft") setT((s) => Math.max(0, s - 5));
else return;
e.preventDefault();
};
const toggleLike = () =>
setLiked((set) => {
const copy = new Set(set);
if (copy.has(index)) copy.delete(index);
else copy.add(index);
return copy;
});
const [a, b, c] = track.colors;
const art = { "--a": a, "--b": b, "--c": c } as CSSProperties;
return (
<div className="gu-music" style={art} data-playing={playing}>
{/* The cover's colors, blown up and blurred, as the screen's backdrop. */}
<div className="gu-music__wash" aria-hidden="true" />
<header className="gu-music__top">
<button
type="button"
className="gu-music__icon"
aria-label="Close player"
>
<svg viewBox="0 0 24 24">
<path d="m6 9 6 6 6-6" />
</svg>
</button>
<p className="gu-music__from">
<span>Playing from album</span>
<strong>{track.album}</strong>
</p>
<button
type="button"
className="gu-music__icon"
aria-label="More options"
>
<svg viewBox="0 0 24 24">
<path d="M5 12h.01M12 12h.01M19 12h.01" />
</svg>
</button>
</header>
<div className="gu-music__art-wrap">
<div
className="gu-music__art"
key={index}
role="img"
aria-label={`Cover of ${track.album}`}
>
<span className="gu-music__sun" />
<span className="gu-music__hill" />
<span className="gu-music__hill gu-music__hill--2" />
<span className="gu-music__grain" />
</div>
</div>
<div className="gu-music__meta">
<div>
<h2 className="gu-music__title">{track.title}</h2>
<p className="gu-music__artist">{track.artist}</p>
</div>
<button
type="button"
className="gu-music__like"
aria-pressed={liked.has(index)}
aria-label={
liked.has(index) ? "Remove from liked songs" : "Add to liked songs"
}
onClick={toggleLike}
>
<svg viewBox="0 0 24 24">
<path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10Z" />
</svg>
</button>
</div>
{/* The waveform is the scrubber. */}
<div
ref={bar}
className="gu-music__wave"
role="slider"
tabIndex={0}
aria-label="Song position"
aria-valuemin={0}
aria-valuemax={Math.round(track.length)}
aria-valuenow={Math.round(t)}
aria-valuetext={`${time(t)} of ${time(track.length)}`}
style={{ "--p": p } as CSSProperties}
onPointerDown={down}
onPointerMove={move}
onPointerUp={up}
onPointerCancel={up}
onKeyDown={keys}
>
{[0, 1].map((layer) => (
<span
key={layer}
className={`gu-music__bars ${layer ? "is-played" : ""}`}
aria-hidden="true"
>
{bars.map((h, i) => (
<span key={i} style={{ height: `${h * 100}%` }} />
))}
</span>
))}
</div>
<div className="gu-music__times" aria-hidden="true">
<span>{time(t)}</span>
<span>-{time(Math.max(0, track.length - t))}</span>
</div>
<div className="gu-music__controls">
<button
type="button"
className="gu-music__icon gu-music__toggle"
aria-label="Shuffle"
aria-pressed={shuffle}
onClick={() => setShuffle((v) => !v)}
>
<svg viewBox="0 0 24 24">
<path d="M4 7h3c5 0 5 10 10 10h3M4 17h3c1.6 0 2.7-1 3.6-2.4M13.4 9.4C14.3 8 15.4 7 17 7h3M17 4l3 3-3 3M17 14l3 3-3 3" />
</svg>
</button>
<button
type="button"
className="gu-music__icon gu-music__skip"
aria-label="Previous"
onClick={() => go(-1)}
>
<svg viewBox="0 0 24 24">
<path className="fill" d="M18 6v12l-9-6 9-6ZM6 6v12" />
</svg>
</button>
<button
type="button"
className="gu-music__play"
aria-label={playing ? "Pause" : "Play"}
onClick={() => setPlaying((v) => !v)}
>
{playing ? (
<svg viewBox="0 0 24 24">
<path className="fill" d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" />
</svg>
) : (
<svg viewBox="0 0 24 24">
<path className="fill" d="M8 5.5v13l11-6.5-11-6.5Z" />
</svg>
)}
</button>
<button
type="button"
className="gu-music__icon gu-music__skip"
aria-label="Next"
onClick={() => go(1)}
>
<svg viewBox="0 0 24 24">
<path className="fill" d="M6 6v12l9-6-9-6ZM18 6v12" />
</svg>
</button>
<button
type="button"
className="gu-music__icon gu-music__toggle"
aria-label="Repeat this song"
aria-pressed={repeat}
onClick={() => setRepeat((v) => !v)}
>
<svg viewBox="0 0 24 24">
<path d="M5 11V9a3 3 0 0 1 3-3h11l-3-3M19 13v2a3 3 0 0 1-3 3H5l3 3" />
</svg>
</button>
</div>
<button
type="button"
className="gu-music__next"
style={
{
"--a": next.colors[0],
"--b": next.colors[1],
"--c": next.colors[2],
} as CSSProperties
}
onClick={() => go(1)}
>
<span className="gu-music__next-art" aria-hidden="true" />
<span className="gu-music__next-text">
<span>Up next</span>
<strong>
{next.title} · {next.artist}
</strong>
</span>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 7h16M4 12h16M4 17h10" />
</svg>
</button>
<p className="gu-music__sr" aria-live="polite">
{`Now playing ${track.title} by ${track.artist}`}
</p>
</div>
);
}
```
### music-player.css
```css
/* MusicPlayer: a dark "now playing" screen tinted by the cover's three colors (--a, --b, --c). */
.gu-music {
--text: #fff;
--muted: rgb(255 255 255 / 0.62);
--faint: rgb(255 255 255 / 0.22);
--focus: #d7ff3a;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
position: relative;
isolation: isolate;
display: flex;
flex-direction: column;
height: 100%;
min-height: 640px;
overflow: hidden;
padding: calc(var(--gu-safe-top, env(safe-area-inset-top, 0px)) + 6px) 26px
calc(var(--gu-safe-bottom, env(safe-area-inset-bottom, 0px)) + 14px);
background: #0c0c0e;
color: var(--text);
font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
}
/* Backdrop: the cover, huge and blurred, then darkened toward the bottom. */
.gu-music__wash {
position: absolute;
inset: -20%;
z-index: -1;
background:
radial-gradient(40% 35% at 30% 22%, var(--a), transparent 70%),
radial-gradient(45% 40% at 75% 30%, var(--b), transparent 70%),
radial-gradient(60% 50% at 50% 70%, var(--c), transparent 75%);
filter: blur(50px) saturate(1.2);
opacity: 0.75;
transition: background 1s ease;
}
.gu-music__wash::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(
rgb(12 12 14 / 0.1),
rgb(12 12 14 / 0.55) 55%,
#0c0c0e 92%
);
}
.gu-music svg {
width: 24px;
height: 24px;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.gu-music svg .fill {
fill: currentColor;
}
.gu-music button {
font: inherit;
color: inherit;
background: none;
border: 0;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.gu-music button:focus-visible,
.gu-music__wave:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 3px;
}
.gu-music__top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.gu-music__icon {
display: grid;
place-items: center;
width: 44px;
height: 44px;
border-radius: 50%;
transition:
background-color 0.2s,
scale 0.2s var(--ease);
}
.gu-music__icon:active {
scale: 0.9;
}
.gu-music__from {
display: grid;
margin: 0;
text-align: center;
font-size: 12px;
line-height: 1.3;
}
.gu-music__from span {
color: var(--muted);
letter-spacing: 0.02em;
}
.gu-music__from strong {
font-size: 14px;
}
/* Cover art, drawn in code: a low sun over two hills, with film grain. */
.gu-music__art-wrap {
display: grid;
place-items: center;
flex: 1;
min-height: 0;
padding: 18px 0 10px;
}
.gu-music__art {
position: relative;
width: min(100%, 338px);
aspect-ratio: 1;
overflow: hidden;
border-radius: 22px;
background: linear-gradient(170deg, var(--b), var(--a) 55%, var(--c));
box-shadow:
0 40px 70px -24px rgb(0 0 0 / 0.65),
0 0 0 1px rgb(255 255 255 / 0.08) inset;
transition:
scale 0.7s var(--ease),
box-shadow 0.7s var(--ease);
animation: gu-music-art-in 0.7s var(--ease);
}
.gu-music[data-playing="false"] .gu-music__art {
scale: 0.84;
box-shadow: 0 20px 40px -24px rgb(0 0 0 / 0.6);
}
.gu-music__sun {
position: absolute;
left: 50%;
top: 22%;
width: 46%;
aspect-ratio: 1;
translate: -50% 0;
border-radius: 50%;
background: radial-gradient(
circle at 40% 35%,
#fff8e8,
color-mix(in oklab, var(--a) 40%, #fff) 60%
);
box-shadow: 0 0 80px 10px color-mix(in oklab, var(--a) 60%, transparent);
}
.gu-music__hill {
position: absolute;
left: -20%;
right: -10%;
bottom: -38%;
height: 78%;
border-radius: 50% 50% 0 0;
background: linear-gradient(
var(--c),
color-mix(in oklab, var(--c) 50%, #000)
);
}
.gu-music__hill--2 {
left: 30%;
right: -40%;
bottom: -46%;
background: linear-gradient(color-mix(in oklab, var(--c) 60%, #000), #08080a);
}
.gu-music__grain {
position: absolute;
inset: 0;
opacity: 0.35;
mix-blend-mode: overlay;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
@keyframes gu-music-art-in {
from {
opacity: 0;
scale: 0.92;
}
}
.gu-music__meta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-top: 8px;
}
.gu-music__title {
margin: 0;
font-size: 24px;
font-weight: 700;
letter-spacing: -0.02em;
}
.gu-music__artist {
margin: 3px 0 0;
font-size: 17px;
color: var(--muted);
}
.gu-music__like {
display: grid;
place-items: center;
width: 44px;
height: 44px;
border-radius: 50%;
background: rgb(255 255 255 / 0.12) !important;
}
.gu-music__like[aria-pressed="true"] svg {
fill: currentColor;
animation: gu-music-pop 0.45s var(--ease);
}
@keyframes gu-music-pop {
40% {
scale: 1.3;
}
}
/* Waveform scrubber: two copies of the bars, the bright one clipped to the progress. */
.gu-music__wave {
position: relative;
height: 46px;
margin-top: 22px;
cursor: pointer;
touch-action: none;
border-radius: 6px;
}
.gu-music__bars {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.gu-music__bars > span {
width: 3px;
border-radius: 2px;
background: var(--faint);
}
.gu-music__bars.is-played {
clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0);
transition: clip-path 0.25s linear;
}
.gu-music__bars.is-played > span {
background: #fff;
}
.gu-music__wave[data-seeking] .gu-music__bars.is-played {
transition: none;
}
.gu-music__times {
display: flex;
justify-content: space-between;
margin-top: 8px;
font-size: 12px;
font-variant-numeric: tabular-nums;
color: var(--muted);
}
.gu-music__controls {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 14px;
}
.gu-music__toggle {
color: var(--muted);
}
.gu-music__toggle[aria-pressed="true"] {
color: var(--focus);
}
.gu-music__skip svg {
width: 32px;
height: 32px;
}
.gu-music__play {
display: grid;
place-items: center;
width: 76px;
height: 76px;
border-radius: 50%;
background: #fff !important;
color: #0c0c0e !important;
box-shadow: 0 14px 30px -10px rgb(0 0 0 / 0.5);
transition: scale 0.3s var(--ease);
}
.gu-music__play:active {
scale: 0.92;
}
.gu-music__play svg {
width: 32px;
height: 32px;
}
.gu-music__next {
display: flex;
align-items: center;
gap: 12px;
margin-top: 20px;
padding: 10px 14px 10px 10px;
border-radius: 18px;
background: rgb(255 255 255 / 0.08) !important;
-webkit-backdrop-filter: blur(20px);
backdrop-filter: blur(20px);
text-align: left;
}
.gu-music__next-art {
width: 42px;
height: 42px;
flex-shrink: 0;
border-radius: 10px;
background:
radial-gradient(circle at 50% 38%, #fff3dc 0 18%, transparent 19%),
linear-gradient(170deg, var(--b), var(--a) 55%, var(--c));
}
.gu-music__next-text {
display: grid;
flex: 1;
min-width: 0;
font-size: 12px;
color: var(--muted);
}
.gu-music__next-text strong {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 14px;
color: var(--text);
}
.gu-music__next > svg {
color: var(--muted);
}
.gu-music__sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
@media (prefers-reduced-motion: reduce) {
.gu-music__art,
.gu-music__bars.is-played,
.gu-music__wash {
transition: none;
animation: none;
}
.gu-music__like[aria-pressed="true"] svg {
animation: none;
}
}
```
You might also want
Next piece: Online course landing page with a free mini lessonBoarding pass app
Apps, intermediate
Cook mode app
Apps, intermediate
Liquid glass tab bar app
Apps, advanced