From c483daecf097a322ee24278bed95455603d5f658 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 26 May 2025 05:37:09 +0200 Subject: [PATCH] Add speech functionality to animeCat.js --- animeCat.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/animeCat.js b/animeCat.js index 65e90de..90c53ac 100644 --- a/animeCat.js +++ b/animeCat.js @@ -460,6 +460,22 @@ window.AnimeCat = class AnimeCat { }, this.talkInterval / 2); } + appendSpeech(chunk) { + if (this._bubbleTextNode) + this._bubbleTextNode.textContent += chunk; + } + + endSpeech() { + clearInterval(this._talkIntervalId); + if (!this._pettingActive) { + this.img.src = this.images.default; + } + this._speechTimeout = setTimeout(() => { + this.bubble.style.opacity = '0'; + this._isSpeaking = false; + }, 6000); + } + destroy() { clearTimeout(this._blinkTimeout); clearInterval(this._talkIntervalId);