slide to object too late

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

slide to object too late

Post by tchobello »

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: 2548
Joined: 29 April 2012, 23:43

Re: slide to object too late

Post by RicardoRix »

setTImeout() (possibly)

setTimeout(function(){ alert("Hello"); }, 3000);
User avatar
tchobello
Posts: 694
Joined: 18 March 2012, 13:19

Re: slide to object too late

Post by tchobello »

thanks a lot RicardoRix
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: slide to object too late

Post by RicardoRix »

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: 76
Joined: 12 December 2013, 23:49

Re: slide to object too late

Post by hersh »

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”