auto-git:
[change] animeCat.js
This commit is contained in:
52
animeCat.js
52
animeCat.js
@@ -312,6 +312,7 @@ window.AnimeCat = class AnimeCat {
|
|||||||
const img = this.img;
|
const img = this.img;
|
||||||
const origTransition = wrapper.style.transition;
|
const origTransition = wrapper.style.transition;
|
||||||
const origTransform = wrapper.style.transform;
|
const origTransform = wrapper.style.transform;
|
||||||
|
const origOrigin = wrapper.style.transformOrigin;
|
||||||
|
|
||||||
img.src = this.images.joy || this.images.default;
|
img.src = this.images.joy || this.images.default;
|
||||||
|
|
||||||
@@ -322,44 +323,43 @@ window.AnimeCat = class AnimeCat {
|
|||||||
this.container.appendChild(this.bubble);
|
this.container.appendChild(this.bubble);
|
||||||
this._positionBubbleDetached();
|
this._positionBubbleDetached();
|
||||||
|
|
||||||
// Berechne Herz-Emitter-Position JETZT
|
// Herz-Emitter sauber platzieren
|
||||||
const catRect = this.img.getBoundingClientRect();
|
const catRect = this.img.getBoundingClientRect();
|
||||||
const contRect = this.container.getBoundingClientRect();
|
const contRect = this.container.getBoundingClientRect();
|
||||||
// Hier kannst du x/y Werte feinjustieren:
|
|
||||||
this.heartEmitter.style.left = (catRect.right - contRect.left + 10) + 'px';
|
this.heartEmitter.style.left = (catRect.right - contRect.left + 10) + 'px';
|
||||||
this.heartEmitter.style.bottom = (contRect.bottom - catRect.bottom + 13) + 'px';
|
this.heartEmitter.style.bottom = (contRect.bottom - catRect.bottom + 13) + 'px';
|
||||||
|
|
||||||
const spawnHearts = () => this._spawnHearts(12);
|
const spawnHearts = () => this._spawnHearts(12);
|
||||||
|
|
||||||
if (salto) {
|
if (salto) {
|
||||||
// 1. Hochspringen & direkt losdrehen
|
// Setzt das Zentrum der Drehung auf Mitte-Unten
|
||||||
wrapper.style.transition = 'transform 0.8s cubic-bezier(.19,1,.22,1)';
|
wrapper.style.transformOrigin = '50% 70%';
|
||||||
wrapper.style.transform = 'translateY(-40px) rotate(0deg)';
|
|
||||||
|
// Sprung und Drehung gleichzeitig
|
||||||
|
wrapper.style.transition = 'transform 1.2s cubic-bezier(.19,1,.22,1)';
|
||||||
|
wrapper.style.transform = 'translateY(-40px) rotate(360deg)';
|
||||||
|
spawnHearts();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 2. Während Sprung: Salto (Herzen werden genau jetzt “ausgestoßen”)
|
// Nur runterfallen, Drehung bleibt auf 360°
|
||||||
wrapper.style.transition = 'transform 0.6s cubic-bezier(.19,1,.22,1)';
|
wrapper.style.transition = 'transform 0.8s cubic-bezier(.19,1,.22,1)';
|
||||||
wrapper.style.transform = 'translateY(-40px) rotate(360deg)';
|
wrapper.style.transform = 'translateY(0) rotate(360deg)';
|
||||||
spawnHearts();
|
img.src = this.images.mouthOpen || this.images.default;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 3. Runterfallen (nur nach unten, KEIN weiteres Rotieren!)
|
if (!this._pettingActive) this.img.src = this.images.default;
|
||||||
wrapper.style.transition = 'transform 0.8s cubic-bezier(.19,1,.22,1)';
|
|
||||||
wrapper.style.transform = 'translateY(0) rotate(360deg)';
|
|
||||||
img.src = this.images.mouthOpen || this.images.default;
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this._pettingActive) this.img.src = this.images.default;
|
wrapper.style.transition = origTransition || '';
|
||||||
setTimeout(() => {
|
wrapper.style.transform = origTransform || '';
|
||||||
wrapper.style.transition = origTransition || '';
|
wrapper.style.transformOrigin = origOrigin || '';
|
||||||
wrapper.style.transform = origTransform || '';
|
this.wrapper.appendChild(this.bubble);
|
||||||
// Bubble zurück
|
this._resetBubbleAttach();
|
||||||
this.wrapper.appendChild(this.bubble);
|
if (typeof onFinish === 'function') onFinish();
|
||||||
this._resetBubbleAttach();
|
}, 700);
|
||||||
if (typeof onFinish === 'function') onFinish();
|
}, 2000);
|
||||||
}, 700);
|
}, 1200); // Erst springen + drehen, dann runterfallen
|
||||||
}, 2000);
|
|
||||||
}, 600);
|
|
||||||
}, 400);
|
|
||||||
} else {
|
} else {
|
||||||
// Normale Joy-Animation
|
// Normale Joy-Animation
|
||||||
|
wrapper.style.transformOrigin = '50% 70%';
|
||||||
wrapper.style.transition = 'transform 0.6s cubic-bezier(.19,1,.22,1)';
|
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)';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -373,7 +373,7 @@ window.AnimeCat = class AnimeCat {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
wrapper.style.transition = origTransition || '';
|
wrapper.style.transition = origTransition || '';
|
||||||
wrapper.style.transform = origTransform || '';
|
wrapper.style.transform = origTransform || '';
|
||||||
// Bubble zurück
|
wrapper.style.transformOrigin = origOrigin || '';
|
||||||
this.wrapper.appendChild(this.bubble);
|
this.wrapper.appendChild(this.bubble);
|
||||||
this._resetBubbleAttach();
|
this._resetBubbleAttach();
|
||||||
if (typeof onFinish === 'function') onFinish();
|
if (typeof onFinish === 'function') onFinish();
|
||||||
|
|||||||
Reference in New Issue
Block a user