From c654e85c8d3d5d4199a54c1205ac1c90cd267310 Mon Sep 17 00:00:00 2001 From: djg Date: Wed, 23 Sep 2026 05:14:31 +0000 Subject: [PATCH] fix(sprint4): logic for Visual pie clock & interval grounding chimes --- site/static/app.js | 6 +++++- site/static/audio.js | 16 ++++++++++++++++ site/static/style.css | 26 +++++++++++++------------- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/site/static/app.js b/site/static/app.js index d6d5722..331ed31 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -322,7 +322,8 @@ } } - function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false; timerPersist(); } + function timerStop() { clearInterval(timer.iv); timer.iv = null; timer.running = false; + if (window.groundingIv) clearInterval(groundingIv); timerPersist(); } function timerComplete() { timerStop(); beep(); @@ -356,8 +357,10 @@ } $('#timer-start').addEventListener('click', function () { + if (window.setGroundingInterval) setGroundingInterval(); if (timer.running) { timerStop(); $('#timer-start').textContent = 'resume'; timerPaint(); return; } timer.running = true; + if (window.setGroundingInterval) setGroundingInterval(); $('#timer-start').textContent = 'pause'; timer.iv = setInterval(function () { timer.left--; @@ -365,6 +368,7 @@ if (timer.left <= 0) { timerComplete(); return; + if (window.groundingIv) clearInterval(groundingIv); } timerPaint(); }, 1000); diff --git a/site/static/audio.js b/site/static/audio.js index ca3819e..92a0375 100644 --- a/site/static/audio.js +++ b/site/static/audio.js @@ -109,3 +109,19 @@ function setupAudioUI() { document.addEventListener('DOMContentLoaded', () => { setupAudioUI(); }); + + +window.playGroundingPing = function() { + if (!audioCtx) initAudio(); + var osc = audioCtx.createOscillator(); + var gain = audioCtx.createGain(); + osc.type = 'sine'; + osc.frequency.setValueAtTime(528, audioCtx.currentTime); // 528hz droplet + gain.gain.setValueAtTime(0, audioCtx.currentTime); + gain.gain.linearRampToValueAtTime(0.3, audioCtx.currentTime + 0.1); + gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + 1.5); + osc.connect(gain); + gain.connect(masterGain); + osc.start(); + osc.stop(audioCtx.currentTime + 1.5); +}; diff --git a/site/static/style.css b/site/static/style.css index 88e6706..fc69c9d 100644 --- a/site/static/style.css +++ b/site/static/style.css @@ -289,8 +289,8 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off z-index: 100; transition: transform 0.2s ease, box-shadow 0.2s ease; } -.unstuck-trigger:hover { - transform: translateY(-3px) scale(1.05); +.unstuck-trigger:hover { + transform: translateY(-3px) scale(1.05); box-shadow: 0 8px 20px rgba(255, 126, 95, 0.6); } @@ -322,7 +322,7 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off .close-modal { position: absolute; top: 15px; right: 20px; - background: none; border: none; font-size: 28px; + background: none; border: none; font-size: 28px; color: var(--text-muted, #a6adc8); cursor: pointer; } .unstuck-phase h2 { margin-top: 0; color: var(--text-main, #cdd6f4); margin-bottom: 15px; } @@ -332,23 +332,23 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off /* Breathing Animation - Physiological Sigh */ .breathing-circle-container { - height: 180px; - display: flex; - justify-content: center; - align-items: center; - position: relative; + height: 180px; + display: flex; + justify-content: center; + align-items: center; + position: relative; margin: 30px 0; } .breathing-circle { width: 80px; height: 80px; border-radius: 50%; - background: rgba(137, 180, 250, 0.4); + background: rgba(137, 180, 250, 0.4); border: 2px solid rgba(137, 180, 250, 0.8); animation: breathe 8s infinite cubic-bezier(0.4, 0, 0.2, 1); } -#breathe-text { - position: absolute; - font-weight: bold; - color: var(--text-main, #cdd6f4); +#breathe-text { + position: absolute; + font-weight: bold; + color: var(--text-main, #cdd6f4); font-size: 1.2em; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }