auto-git:
[change] animeCat.js
This commit is contained in:
26
animeCat.js
26
animeCat.js
@@ -391,19 +391,28 @@ _runJoyAnimation(onFinish) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_makeHeart() {
|
_makeHeart() {
|
||||||
// Emoji oder eigenes Bild
|
// Emoji oder eigenes Bild
|
||||||
const emoji = Math.random() < 0.7 ? '❤️' : '💕';
|
const emoji = Math.random() < 0.7 ? '❤️' : '💕';
|
||||||
|
|
||||||
const heart = document.createElement('span');
|
const heart = document.createElement('span');
|
||||||
heart.textContent = emoji;
|
heart.textContent = emoji;
|
||||||
heart.style.position = 'absolute';
|
heart.style.position = 'absolute';
|
||||||
heart.style.left = '30%';
|
|
||||||
heart.style.bottom= '45%';
|
// Startposition relativ zur Katze berechnen:
|
||||||
|
const catRect = this.img.getBoundingClientRect();
|
||||||
|
const containerRect = this.container.getBoundingClientRect();
|
||||||
|
|
||||||
|
// Starte etwas über dem Mittelpunkt der Katze
|
||||||
|
const left = (catRect.left + catRect.width * 0.5) - containerRect.left;
|
||||||
|
const bottom = (containerRect.bottom - (catRect.top + catRect.height * 0.4));
|
||||||
|
heart.style.left = `${left}px`;
|
||||||
|
heart.style.bottom = `${bottom}px`;
|
||||||
|
|
||||||
heart.style.fontSize = `${16 + Math.random() * 14}px`;
|
heart.style.fontSize = `${16 + Math.random() * 14}px`;
|
||||||
heart.style.pointerEvents = 'none';
|
heart.style.pointerEvents = 'none';
|
||||||
heart.style.opacity = '0.9';
|
heart.style.opacity = '0.9';
|
||||||
heart.style.zIndex = 10;
|
heart.style.zIndex = 1000;
|
||||||
|
|
||||||
// Start/End-Pos, Flugwinkel
|
// Start/End-Pos, Flugwinkel
|
||||||
const angle = (Math.random() * Math.PI) - (Math.PI/2); // spread -90° to 90°
|
const angle = (Math.random() * Math.PI) - (Math.PI/2); // spread -90° to 90°
|
||||||
@@ -425,12 +434,13 @@ _runJoyAnimation(onFinish) {
|
|||||||
easing: 'cubic-bezier(.28,1.01,.57,.99)'
|
easing: 'cubic-bezier(.28,1.01,.57,.99)'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove after animation
|
|
||||||
setTimeout(() => heart.remove(), 1600);
|
setTimeout(() => heart.remove(), 1600);
|
||||||
|
|
||||||
// Im Cat-Wrapper anbringen:
|
// Jetzt direkt in den Container anhängen (NICHT an this.wrapper!)
|
||||||
this.wrapper.appendChild(heart);
|
this.container.appendChild(heart);
|
||||||
}
|
|
||||||
|
return heart;
|
||||||
|
}
|
||||||
|
|
||||||
/** Call when streaming text begins */
|
/** Call when streaming text begins */
|
||||||
beginSpeech() {
|
beginSpeech() {
|
||||||
|
|||||||
Reference in New Issue
Block a user