slide to object too late

Game development with Board Game Arena Studio
Post Reply
User avatar
tchobello
Posts: 138
Joined: 18 March 2012, 13:19

slide to object too late

Post by tchobello » 02 December 2019, 17:31

Hello
I have 3 cards in 'playertables' which rejoin the others in the player's hand.
As I don't need 'playertables' any more , I change the display to 'none'.

But the sliding animation doesn't appear.
How can I delay the disappearance of the 'playertables' ?

Code: Select all

		card_on_table = 'cardontable_' + this.player_id + '_' + card.id;
		this.playerHand.addToStockWithId(card_type,card.id);
		this.slideToObjectAndDestroy(card_on_table, 'myhand', 1000, 0);

                dojo.style( 'playertables', 'display', 'none' );     

User avatar
RicardoRix
Posts: 659
Joined: 29 April 2012, 23:43

Re: slide to object too late

Post by RicardoRix » 02 December 2019, 20:23

setTImeout() (possibly)

setTimeout(function(){ alert("Hello"); }, 3000);

User avatar
tchobello
Posts: 138
Joined: 18 March 2012, 13:19

Re: slide to object too late

Post by tchobello » 02 December 2019, 20:58

thanks a lot RicardoRix

User avatar
RicardoRix
Posts: 659
Joined: 29 April 2012, 23:43

Re: slide to object too late

Post by RicardoRix » 02 December 2019, 22:05

I wonder if a css animation delay might work.
https://www.w3schools.com/cssref/css3_pr_animation.asp

Or dojo must have a few ways like a property animation, possibly.

User avatar
hersh
Posts: 7
Joined: 12 December 2013, 23:49

Re: slide to object too late

Post by hersh » 03 December 2019, 05:28

yes dojo is probably better to use. BGA animation is done via dojo.fx (https://dojotoolkit.org/reference-guide ... ation.html) and there is an onEnd event you can hook into.

however I do not think slideToObjectAndDestroy returns the animation object, but slideToObject does.

something like:
var anim = this.slideToObject(...);
anim.onEnd = function(n) {
// destroy node
// hide player tables
};
anim.play();

Post Reply

Return to “Developers”