From d4c5069e4052818afe3901d5fe4ff23bfef17576 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 26 May 2025 04:55:24 +0200 Subject: [PATCH] Refactor mouth open time calculation and conditional logic in animeCat.js --- animeCat.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/animeCat.js b/animeCat.js index 4018cc0..f0334c5 100644 --- a/animeCat.js +++ b/animeCat.js @@ -213,15 +213,17 @@ _bindMouseHold() { mouseDown = false; reopenEyes(); const heldFor = Date.now() - mouseDownAt; - const mouthOpenTime = Math.max(heldFor - 1000, 700); - if (mouthOpenTime > 0) { + if (heldFor > 1000) { + // mind. 500ms oder (heldFor - 1000), je nachdem was größer ist + const mouthOpenTime = Math.max(heldFor - 1000, 500); this.img.src = this.images.mouthOpen || this.images.default; this._startBlinking(); setTimeout(() => { - if (!joyActive && !this._isSpeaking && !this._pettingActive) this.img.src = this.images.default; + if (!joyActive && !this._isSpeaking && !this._pettingActive) { + this.img.src = this.images.default; + } }, mouthOpenTime); - } - else { + } else { this._startBlinking(); } }