feat: double album art size; remove horizon beat pulse
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
daaf947be3
commit
2acd2389cb
1 changed files with 3 additions and 23 deletions
|
|
@ -96,13 +96,6 @@ html, body {
|
||||||
0%, 100% { opacity: 0.75; }
|
0%, 100% { opacity: 0.75; }
|
||||||
50% { opacity: 1; }
|
50% { opacity: 1; }
|
||||||
}
|
}
|
||||||
@keyframes horizonBeat {
|
|
||||||
0% { opacity: 1; box-shadow: 0 0 60px var(--theme-color, rgba(0,220,255,1)), 0 0 140px var(--theme-color, rgba(0,200,255,0.6)), 0 0 8px #fff; filter: brightness(2.5); }
|
|
||||||
100% { opacity: 0.75; box-shadow: 0 0 25px rgba(0,220,255,0.8), 0 0 80px rgba(0,200,255,0.25); filter: brightness(1); }
|
|
||||||
}
|
|
||||||
.horizon.beat {
|
|
||||||
animation: horizonBeat 0.45s ease-out forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
SPECTRUM VISUALIZER (behind character)
|
SPECTRUM VISUALIZER (behind character)
|
||||||
|
|
@ -163,8 +156,8 @@ html, body {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 4%;
|
top: 4%;
|
||||||
right: 2%;
|
right: 2%;
|
||||||
width: 110px;
|
width: 220px;
|
||||||
height: 110px;
|
height: 220px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 0 18px rgba(0,0,0,0.8), 0 0 8px var(--theme-color, rgba(0,220,255,0.5));
|
box-shadow: 0 0 18px rgba(0,0,0,0.8), 0 0 8px var(--theme-color, rgba(0,220,255,0.5));
|
||||||
transition: opacity 0.6s ease, box-shadow 0.6s ease;
|
transition: opacity 0.6s ease, box-shadow 0.6s ease;
|
||||||
|
|
@ -999,27 +992,14 @@ for (let i = 0; i < VU_COUNT; i++) {
|
||||||
|
|
||||||
// Beat detection
|
// Beat detection
|
||||||
const BASS_BARS = 4;
|
const BASS_BARS = 4;
|
||||||
const BEAT_THRESH = 1.5;
|
let bassSmooth = 0, bassEma = 0;
|
||||||
const BEAT_COOLDOWN = 280;
|
|
||||||
let bassSmooth = 0, bassEma = 0, lastBeat = 0;
|
|
||||||
const beatWrap = document.querySelector('.beat-wrap');
|
const beatWrap = document.querySelector('.beat-wrap');
|
||||||
const horizonEl = document.querySelector('.horizon');
|
const horizonEl = document.querySelector('.horizon');
|
||||||
|
|
||||||
function triggerBeat() {
|
|
||||||
horizonEl.classList.remove('beat');
|
|
||||||
void horizonEl.offsetWidth;
|
|
||||||
horizonEl.classList.add('beat');
|
|
||||||
}
|
|
||||||
|
|
||||||
function detectBeat(vals) {
|
function detectBeat(vals) {
|
||||||
const bass = vals.slice(0, BASS_BARS).reduce((s, v) => s + v, 0) / BASS_BARS;
|
const bass = vals.slice(0, BASS_BARS).reduce((s, v) => s + v, 0) / BASS_BARS;
|
||||||
bassSmooth = bassSmooth * 0.6 + bass * 0.4;
|
bassSmooth = bassSmooth * 0.6 + bass * 0.4;
|
||||||
bassEma = bassEma * 0.96 + bass * 0.04;
|
bassEma = bassEma * 0.96 + bass * 0.04;
|
||||||
const now = performance.now();
|
|
||||||
if (bassSmooth > bassEma * BEAT_THRESH && bassSmooth > 8 && now - lastBeat > BEAT_COOLDOWN) {
|
|
||||||
lastBeat = now;
|
|
||||||
triggerBeat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called with semicolon-separated CAVA values (0–100 per bar)
|
// Called with semicolon-separated CAVA values (0–100 per bar)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue