Page 1 of 1

slide to object too late

Posted: 02 December 2019, 17:31
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' );     

Re: slide to object too late

Posted: 02 December 2019, 20:23
by RicardoRix
setTImeout() (possibly)

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

Re: slide to object too late

Posted: 02 December 2019, 20:58
by tchobello
thanks a lot RicardoRix

Re: slide to object too late

Posted: 02 December 2019, 22:05
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.

Re: slide to object too late

Posted: 03 December 2019, 05:28
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();