So I’m trying to make a launch animation with bindings, but something weird is happening.

So I’m trying to make a launch animation with bindings, but something weird is happening.

I have this script on the tap event:

function setAndClearTimeout(func, timeout){

var id = setTimeout(function(){

clearTimeout(id);

func();

}, timeout);

}

getVariables().edit()

.setInteger(“itId”, getEvent().getItem().getId())

// .commit()

//getVariables().edit()

.setFloat(“launchScale”, 0.75)

.commit();

setAndClearTimeout(function(){

getVariables().edit()

.setInteger(“itId”, 0)

.setFloat(“launchScale”, 1)

.commit();

}, 1000);

With this binding on an item

$itId === item.getId() ? animate(“$launchScale”) : 1

What happens is: the item scale snaps to 0.75 en then back to 1 without animation. If I uncomment the lines

// .commit()

//getVariables().edit()

The downscaling is animated, but the upscaling is not (what i want on this case)

Does anybody know why the first method doesn’t work and the second does?

]]>

One Commentto So I’m trying to make a launch animation with bindings, but something weird is happening.

  1. Anonymous says:

    < ![CDATA[

    I don’t know exactly why this is happening yet, but it seems like a general rule to follow is to not change other variables than the one you’re animating, but the animation is dependent on, in the same commit as the change of the animation variable

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *