From 34c6789c7661a496233627de9990b54f7146e0ef Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 26 May 2025 07:11:39 +0200 Subject: [PATCH] Refactor glow color and size calculation in animeCat.js --- animeCat.js | 20 +++++++++++++++----- index.html | 6 ++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/animeCat.js b/animeCat.js index 61a7bb5..c9110c9 100644 --- a/animeCat.js +++ b/animeCat.js @@ -153,18 +153,28 @@ window.AnimeCat = class AnimeCat { const glow = this.glow; if (!glow) return; - const factor = Math.min(commitCount / 10, 1); + // Farbinterpolation je nach Commits: + function getGlowColor(count) { + if (count < 10) return [60, 230, 100]; // grĂ¼n + if (count < 50) return [100, 180, 255]; // blau + if (count < 100) return [180, 120, 255]; // lila + if (count < 500) return [255, 180, 60]; // orange + return [255, 100, 0]; // voll orange + } + const [r, g, b] = getGlowColor(commitCount); + + // Skalierung bleibt wie gehabt const minSize = 80, maxSize = 170; + const factor = Math.min(commitCount / 500, 1); // jetzt auf 500 skalieren! const size = minSize + factor * (maxSize - minSize); glow.style.width = `${size}px`; - glow.style.height = `${size * 0.66}px`; - glow.style.opacity = 0.2 + 0.8 * factor; - glow.style.background = `radial-gradient(circle, rgba(255,230,100,${0.7 + factor*0.3}) 0%, rgba(255,230,100,${0.10 + 0.5*factor}) 70%, rgba(0,0,0,0) 100%)`; + glow.style.height = `${size}px`; // jetzt immer Kreis! + glow.style.opacity = 0.25 + 0.65 * factor; + glow.style.background = `radial-gradient(circle, rgba(${r},${g},${b},0.9) 0%, rgba(${r},${g},${b},0.13) 65%, rgba(0,0,0,0) 100%)`; } - // Bubble-Position absolut anpassen, wenn detached _positionBubbleDetached() { // Katze relativ im Container finden diff --git a/index.html b/index.html index 93215be..ae5cec9 100644 --- a/index.html +++ b/index.html @@ -165,14 +165,12 @@ /*maybe move this into the cat later*/ #cat-glow { - background: radial-gradient(circle, rgba(255,230,100,0.9) 0%, rgba(255,230,100,0.15) 75%, rgba(0,0,0,0) 100%); position: absolute; left: 50%; top: 50%; - transform: translate(-50%, -60%); - width: 120px; height: 80px; + transform: translate(-50%, -50%); pointer-events: none; z-index: 1; - opacity: 1; + border-radius: 50%; transition: box-shadow 0.5s cubic-bezier(.8,.2,.2,1), background 0.5s cubic-bezier(.8,.2,.2,1),