Feature: lasers synced to beat

This commit is contained in:
Dejvino 2026-01-03 22:08:38 +00:00
parent 2d570b8141
commit 8ed8ea9d34

View File

@ -124,15 +124,19 @@ export class StageLasers extends SceneFeature {
isActive = true;
this.stateTimer -= deltaTime;
if (this.stateTimer <= 0) {
this.activationState = 'ACTIVE';
this.stateTimer = 4.0; // Active duration
if (state.music.beatIntensity > 0.8) {
this.activationState = 'ACTIVE';
this.stateTimer = 4.0; // Active duration
}
}
} else if (this.activationState === 'ACTIVE') {
isActive = true;
this.stateTimer -= deltaTime;
if (this.stateTimer <= 0) {
this.activationState = 'FADEOUT';
this.stateTimer = 1.0; // Fadeout duration
if (state.music.beatIntensity > 0.8) {
this.activationState = 'FADEOUT';
this.stateTimer = 1.0; // Fadeout duration
}
}
} else if (this.activationState === 'FADEOUT') {
isActive = true;
@ -184,7 +188,11 @@ export class StageLasers extends SceneFeature {
if (this.activationState === 'WARMUP') {
currentIntensity = 0;
flareScale = 1.0 - this.stateTimer;
if (this.stateTimer > 0) {
flareScale = 1.0 - this.stateTimer;
} else {
flareScale = 1.0 + Math.sin(time * 30) * 0.2; // Pulse while waiting for beat
}
} else if (this.activationState === 'FADEOUT') {
const fade = Math.max(0, this.stateTimer / 1.0);
currentIntensity = 0;