- Home /
iTween FadeTo
I'm going crazy... I will do fade between 3 group of object (3 object that have 3 child each). I'm using iTween. It is work only for the first fade. After the first fade script must be deactivate the first group of object, but It doesn't... I don't understand...
var OBJFirst : GameObject;
var OBJSecond : GameObject;
var SingleTouch : boolean = true;
var DoubleTap : boolean = false;
var Swipe : boolean = false;
var AlphaHigh : float = 1.0;
var AlphaLow : float = 0.0;
var velocity : float = 1.0;
var TimeDelay : float = 0.0;
private var var_Fade : boolean = false;
private var GoTouch : boolean = true;
function Awake () {
}
function Start () {
}
function Update () {
if (var_Fade){
fun_Fade();
}
}
function fun_Fade(){
iTween.FadeTo(OBJFirst,{"a":AlphaLow, "time":velocity, "delay":TimeDelay, "onComplete":"fun_FadeFalse", "onCompleteTarget": OBJFirst});
iTween.FadeTo(OBJSecond,{"a":AlphaHigh, "time":velocity, "delay":TimeDelay, "onComplete":"fun_FadeFalse", "onCompleteTarget": OBJSecond});
}
function fun_FadeFalse() { // this must be deactivate first group and all child
var_Fade = false;
Manager.GoTouch = true;
OBJFirst.SetActiveRecursively(false);
}
function On_TouchStart(gesture:Gesture){
if (Manager.GoTouch){
if (SingleTouch){
Manager.GoTouch = false;
OBJSecond.SetActiveRecursively(true);
var_Fade = true;
}
}
}
Help.
Answer by justinl · Sep 28, 2012 at 05:18 AM
It's because in fun_FadeFalse(), you only specify OBJFirst, and you never specify OBJSecond to turn false anywhere.
I may not have understood your question though, so it could also be that you need to specify the "ontargetcomplete" to gameObject since your functions are within this script, and not attached to those other objects.
Your answer
Follow this Question
Related Questions
Fade in object using iTween 0 Answers
iTween :: fading out an empty with Children 1 Answer
How do I fade out a Toon shaded character with iTween? 1 Answer
iTween can't access instantiated child. 1 Answer
Material doesn't have property '_Color' 4 Answers