ÇHow can I activate and deactivate an iTween animation over an object?

Hi mates!.

My question is : how can I activate and deactivate an animation made with iTween?.

I’ve got my iTween animation applied over an object with their child objects inside and I want that this object appears, execute its animation and disappears when the animation is completed.

I want to control the appearing and playing its animation when a counter reaches some value from another script.

iTweenEvent.GetEvent(WOW, escalado).Play();

Inside an if with the counter reaching the trigger value I tried to activate the animation…But the animation didn’t start.

Other option could be activate and deactivate the object with the option “play automatically” activated…But I think it’s not very elegant.

I’d like any way to handle these events in javascript for iTween inside Unity3D.

Thank you very much in advance.

1 Answer

1

Just put the iTween code in a function, then call that function when you need it.

Pseudo-code:

function AnimateCube()
{
    iTween.animationcode
}

function Update()
{
if(animate = true)
{
    AnimateCube()
}

Thanks for your help. :-)