How to trigger an iTween animation done with iTween Visual Editor via Java Script??

Hi All,

I just installed iTween with its Visual Editor. It works very nice, but i'm not able to trigger an animation a set up via JavaScript. Lets say i have 2 animations: 1 to scale the cube in 2 seconds and other to rotate it. I just want to start them via Javascript... The iTween Visual Editor developer says that there is a .Play() method but i don't know how to call this method for each animation.

any idea ??

Thanks everyone!

To trigger an event manually you need to get a reference to the iTweenEvent and then call the Play method on that component. There is a static iTweenEvent method that helps you get your particular event.

iTweenEvent.GetEvent(theGameObjectWithTheiTweenEvent, "name of your event here").Play();

There is an example project here that shows how to do this:

I don't know about any "Play()" method, but I suggest doing with just script here is what I would do

function OnTriggerEnter (collider : Collider)
      //say that you want to scale the cube to (5,5,5) in of-course 2 seconds.
      iTween.ScaleTo(collider.gaemObject, {"x":5,"y":5,"z":5,"time":2});
      //say that you also wanted to rotate it to (0,45,0)
      iTween.RotateTo(collider.gameObject, {"y":45,"time":2});

now just add this to your trigger object (plus, I think you need to download normal iTween for this to work)! Hope this helps. :)