feat(ui): Vue
Added wiggle animation when you want to play a card that you aren't allowed to.
This commit is contained in:
@@ -59,8 +59,7 @@ const PlayerHandComponent = {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isHandInactive() {
|
isHandInactive() {
|
||||||
console.log("isHandInactive got executed" + !canPlayCard)
|
//TODO: Needs implementation
|
||||||
return !canPlayCard
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
@@ -122,6 +121,8 @@ const PlayerHandComponent = {
|
|||||||
easing: 'ease-in-out',
|
easing: 'ease-in-out',
|
||||||
fill: 'forwards'
|
fill: 'forwards'
|
||||||
};
|
};
|
||||||
|
const targetButton = this.$el.querySelector(`[data-card-id="${cardidx}"]`);
|
||||||
|
const cardElement = targetButton ? targetButton.closest('.handcard') : null;
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
cardindex: cardidx.toString(),
|
cardindex: cardidx.toString(),
|
||||||
@@ -138,8 +139,14 @@ const PlayerHandComponent = {
|
|||||||
}
|
}
|
||||||
).catch(
|
).catch(
|
||||||
(err) => {
|
(err) => {
|
||||||
|
if (cardElement) {
|
||||||
|
cardElement.animate(wiggleKeyframes, wiggleTiming);
|
||||||
|
} else {
|
||||||
|
console.warn(`Could not find DOM element for card index ${cardidx} to wiggle.`);
|
||||||
|
}
|
||||||
this.isAwaitingResponse = false;
|
this.isAwaitingResponse = false;
|
||||||
canPlayCard = true;
|
canPlayCard = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user