feat(labs): visual polish wave — LabFX foundation + 33 sims juiced up
ФУНДАМЕНТ (4 новых файла): - _fx_core.js: LabFX namespace, glow.drawGlow, glow.pulse, haptic, shake - _fx_particles.js: пул 1500 объектов, 6 shapes (dot/spark/ring/smoke/splash/dust) - _fx_motion.js: tween + 12 easings + critically-damped spring - _fx_sound.js: 9 procedural synth-звуков (click/tick/whoosh/chime/fizz/spark/bounce/pour/drone), Web Audio API - Sound toggle в шапке lab.html с localStorage-persist UX МИКРО (CSS + JS): - Button states: hover scale+brightness, active scale-down, disabled grayscale - Slider polish: custom thumb с тенью, filled-track gradient, hover/active - Focus rings через :focus-visible - Tooltip system .tt-host data-tt= с 400ms hover, fade-in - Marching ants для selection - Loading skeleton с shimmer - Empty state .sim-empty-* паттерн - Toast: progress bar внизу, icons по типу - Cursor states utility classes - View Transitions API для smooth sim-switch, fallback на CSS fade PHASE 2 — визуальные эффекты для 33 симуляций: Physics motion: projectile (launch whoosh + landing splash/shake/haptic + target chime), pendulum (max-extension tick + bob glow), collision (bounce + sparks + shake), angrybirds (whoosh/bounce/fizz/chime + confetti), newton (rocket flame trail + scene transitions), forcesandbox (spring glow + impact sparks) Physics fields: emfield (field-lines glow + particle trail + lightning при high field + Gauss-drag haptic + rod motion sparks), circuit (energized-wire glow ∝ current + LED bloom + short-circuit shake/spark + heat shimmer smoke + place/erase/switch sounds), opticsbench (beam glow на всех режимах + caustics dust у фокуса + TIR/Brewster one-shot sounds) Thermo+waves: waves (mode-switch whoosh + Mach-cone particles + spectrum harmonic chime + waveform glow), hydrostatics (pour sound + splash при погружении + valve click), isoprocess (PV-trail dust), heatengine (drone цикла + hot/cold reservoir smoke/dust + phase-change ticks), radioactive (Geiger tick throttle + decay sparks + half-life chime + α/β/γ glow) Chemistry: chemsandbox (pour splash + fizz bubbles/dust/spark по типу реакции + shake при горении), equilibrium/electrolysis/reactions/titration/flask/ionexchange/redox (pour/fizz/spark/chime по событиям, частицы при ключевых моментах), stoichiometry (fizz bubbles + recipe-change click) Math+geom: geometry (tool-click + object-create tick + locus glow + challenge confetti via LabFX + haptic), triangle (vertex-drop tick + special-point glow), stereo (figure-change whoosh + cross-section chime, no particles — Three.js), trigcircle (drag-haptic + pitch∝angle tick + sin/cos glow), graph/graphtransform/quadratic (slider-tick throttled + curve glow + discriminant-cross chime), probability (bounce + finish-chime burst), normaldist (pulsing shade + bell glow) Bio+misc: celldivision (phase-change whoosh + prophase dust + anaphase poles spark + cytokinesis chime), photosynthesis (photon tick + ATP chime + glucose sparkle), bohratom (electron-jump chime ∝ levels + photon spark), orbitals/crystal (mode-change whoosh — Three.js, sound only), logic (gate-place + wire-connect + LED bloom + HIGH wire flowing dots + preset chime), gas/brownian/diffusion/states (preset whoosh, throttled tick по событиям) Все LabFX вызовы обёрнуты в if (window.LabFX) guard — graceful degradation если фундамент не загружен. 47 JS файлов прошли syntax check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,15 @@ class FlaskSim {
|
||||
this._h2 = 0;
|
||||
this._bubTmr = 0;
|
||||
this._boomCD = 0;
|
||||
|
||||
if (window.LabFX) {
|
||||
LabFX.sound.play('bounce', { pitch: 0.6 });
|
||||
// Brief delay then fizz as metal hits acid
|
||||
setTimeout(() => { if (window.LabFX) LabFX.sound.play('fizz'); }, 350);
|
||||
LabFX.particles.emit({ ctx: this.ctx, x: cx, y: nt - 5, count: 6,
|
||||
color: '#FFFFFF', speed: 25, spread: 1.6, angle: -Math.PI / 2,
|
||||
gravity: -60, life: 1500, shape: 'ring' });
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
@@ -210,7 +219,7 @@ class FlaskSim {
|
||||
this.draw();
|
||||
}
|
||||
|
||||
togglePause() { this._paused = !this._paused; }
|
||||
togglePause() { this._paused = !this._paused; if (window.LabFX) LabFX.sound.play('click'); }
|
||||
toggleFlame() { this._flameOn = !this._flameOn; }
|
||||
setMetal(t) { this.metalType = t; }
|
||||
setAcid(t) { this.acidType = t; this.reset(); }
|
||||
@@ -230,6 +239,7 @@ class FlaskSim {
|
||||
_tick(now) {
|
||||
const dt = Math.min((now - this._last) / 1000, 0.05);
|
||||
this._last = now;
|
||||
if (window.LabFX) LabFX.particles.update(dt);
|
||||
if (!this._paused) {
|
||||
this._wave += dt * 1.7;
|
||||
this._wave2 += dt * 2.3;
|
||||
@@ -503,6 +513,12 @@ class FlaskSim {
|
||||
r: 3 + Math.random() * 5, col: i < 30 ? '#FFD166' : '#FF6B35', life: 1,
|
||||
});
|
||||
}
|
||||
if (window.LabFX) {
|
||||
LabFX.sound.play('whoosh', { pitch: 1.5 });
|
||||
LabFX.particles.emit({ ctx: this.ctx, x: cx, y: nt - 10, count: 20,
|
||||
color: '#FFA500', speed: 80, spread: 2.0, angle: -Math.PI / 2,
|
||||
gravity: -100, life: 300, shape: 'spark', glow: true });
|
||||
}
|
||||
}
|
||||
|
||||
/* ════════════════════════════════════════════════════════════════
|
||||
@@ -549,6 +565,7 @@ class FlaskSim {
|
||||
this._drawH2Bar(ctx);
|
||||
this._drawInfoPanel(ctx);
|
||||
if (!this._metal || this._metal.mass <= 0.01) this._drawHint(ctx);
|
||||
if (window.LabFX) LabFX.particles.draw(ctx);
|
||||
}
|
||||
|
||||
/* ── Тень/отражение колбы на столе ── */
|
||||
|
||||
Reference in New Issue
Block a user