From 96cf5f6dc10109979ad9c2e0037d2ac80521e8cc Mon Sep 17 00:00:00 2001 From: ectasy663 Date: Fri, 10 Jul 2026 13:49:03 +0530 Subject: [PATCH] Change sadness threshold to streak <= 2 --- public/streak-animation.html | 6 +++--- scratch/port_streak_clean.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/public/streak-animation.html b/public/streak-animation.html index e974a94..55a3a47 100644 --- a/public/streak-animation.html +++ b/public/streak-animation.html @@ -359,8 +359,8 @@ function play(){ clearTimeout(countTimer); clearTimeout(moodTimer); cancelAnimationFrame(countRAF); stopFw(); const target=parseTarget(); - const sad = target<5; - const t = sad ? 0 : Math.min(1, Math.log10(Math.max(target,5)/5)/3); // 5→0 … 5000+→1 + const sad = target<=2; + const t = sad ? 0 : Math.min(1, Math.log10(Math.max(target,3)/3)/3); // 5→0 … 5000+→1 // set mood + intensity stage.classList.remove('play','happy','sad','tier1','tier2','tier3'); body.classList.remove('sad'); @@ -376,7 +376,7 @@ numEl.textContent='0'; void stage.offsetWidth; stage.classList.add('play'); - const sadS = Math.max(0, Math.min(1, (4 - target) / 3)); // 1→1 (most), 4→0 (least) + const sadS = Math.max(0, Math.min(1, (3 - target) / 3)); // 1→1 (most), 4→0 (least) if(reduce.matches){ numEl.textContent=target.toLocaleString(); if(sad){ setTimeout(()=>sadFaces(sadS),0);} return; } moodTimer=setTimeout(()=> sad ? sadFaces(sadS) : celebrate(t), 2650); diff --git a/scratch/port_streak_clean.py b/scratch/port_streak_clean.py index a69f122..6430f4d 100644 --- a/scratch/port_streak_clean.py +++ b/scratch/port_streak_clean.py @@ -50,6 +50,11 @@ def port_html(): }""" html = re.sub(r"\.badge\s*\{[^}]*\}", new_badge_css, html, flags=re.DOTALL) + # 4. Modify sad threshold and intensity scaling + html = html.replace("const sad = target<5;", "const sad = target<=2;") + html = html.replace("Math.max(target,5)/5", "Math.max(target,3)/3") + html = html.replace("(4 - target) / 3", "(3 - target) / 3") + with open(dest_path, 'w', encoding='utf-8') as f: f.write(html) print("Ported successfully to public/streak-animation.html")