iTween ColorTo/ColorFrom repeating between many colors in iOS

Is it possible to have the color of an object turn to green, then to the original color, then to blue then to the original color, the transition sequence being made in say 0.9 seconds and loop this whole group of transitions for a specific amount of time?

I use the following script, which is applied on the object the color of which I want to change the way I described. The color changing sequence will begin once "condition" boolean is true (condition is a static var of type boolean that's located in "OtherScript.js").

function Update () {
    if (OtherScript.condition){
InvokeRepeating("ChangeColors",0,1.2);
    }
}

    function ChangeColors (){   
        iTween.ColorTo(gameObject,{"g": 2, "time": 0.3}); 
        iTween.ColorFrom(gameObject,{"g": 2, "time": 0.3, "delay":0.3}); 
        iTween.ColorTo(gameObject,{"b": 2,"time": 0.3, "delay":0.6}); 
        iTween.ColorFrom(gameObject,{"b": 2,"time": 0.3, "delay":0.9}); 
}

I test the game with Unity Remote. At the beginning "condition" is false (default value of this var) and the fps are about 170. When it becomes true (this happens by selecting some powerups that are supposed to give my object some special characteristics for a specific amount of time) the fps fall to 2 (!) which is unplayable of course.

Thanks in advance for any suggestion! :-)

if (OtherScript.condition) InvokeRepeating("ChangeColors",0,1.2);

Having this in an Update() function means that you will be calling ChangeColors every frame. And after that, it will continue to happen every 1.2 seconds. Obviously, that won't work, and isn't what you want. Event Handlers are the best way I know of, to take care of this, but I don't even know if they exist in UnityScript. You at least need to "undo" the condition. It isn't efficient code, if you just do that, but at least it won't yield unexpected results:

if (OtherScript.condition) {
    InvokeRepeating("ChangeColors",0,1.2);
    OtherScript.condition = false;
}

If you look into the docs for iTween you will notice the "From" methods will cause an instantaneous change therefore the approach you are trying won't work.

I would suggest setting a variable to hold the color of the object the fire off a few delayed iTween.ColorTo methods to change it back and forth.

Good luck.