1
0

Refactor and optimize animeCat.js for better performance and readability

This commit is contained in:
2025-05-26 04:14:34 +02:00
parent 0de4e4dd70
commit 4fcf05844b

View File

@@ -282,35 +282,26 @@ _bindMouseHold() {
// Bild auf joy.png setzen:
img.src = this.images.joy || this.images.default;
// Wrapper animieren: nach oben + rechts, leicht rotieren
// Nach oben springen und nach RECHTS rotieren:
wrapper.style.transition = 'transform 0.6s cubic-bezier(.19,1,.22,1)';
wrapper.style.transform = 'translateY(-40px) rotate(12deg)';
wrapper.style.transform = 'translateY(-40px) rotate(12deg)'; // <--- POSITIV!
// Herzchen-Explosion starten
this._spawnHearts(12);
// Nach 0.4s (Sprung oben), dann warten (stehen lassen)
setTimeout(() => {
// Nach weiteren 2.2s zurückfallen (gesamt ca. 2.6s joy-mode)
setTimeout(() => {
// Rücksprung: nach unten
// Rücksprung nach unten, zurückdrehen:
wrapper.style.transition = 'transform 0.8s cubic-bezier(.19,1,.22,1)';
wrapper.style.transform = 'translateY(0) rotate(0deg)';
// → → → Hier: Bild auf mouth_open setzen!
img.src = this.images.mouthOpen || this.images.default;
// Nach 3 Sekunden: Bild zurück zu default
setTimeout(() => {
img.src = this.images.default;
// Reset nach 0.7s (Animation zu Ende)
setTimeout(() => {
wrapper.style.transition = origTransition || '';
wrapper.style.transform = origTransform || '';
if (typeof onFinish === 'function') onFinish();
}, 700);
}, 2000);
}, 2200);
}, 400);
}