public static void ValueTo(GameObject target, Hashtable args)
{
//clean args:
args = iTween.CleanArgs(args);
if (!args.Contains("onupdate") || !args.Contains("from") || !args.Contains("to")) {
Debug.LogError("iTween Error: ValueTo() requires an 'onupdate' callback function and a 'from' and 'to' property. The supplied 'onupdate' callback must accept a single argument that is the same type as the supplied 'from' and 'to' properties!");
return;
}else{
//establish iTween:
args["type"]="value";
if (args["from"].GetType() == typeof(Vector2)) {
args["method"]="vector2";
}else if (args["from"].GetType() == typeof(Vector3)) {
args["method"]="vector3";
}else if (args["from"].GetType() == typeof(Rect)) {
args["method"]="rect";
}else if (args["from"].GetType() == typeof(Single)) {
args["method"]="float";
}else if (args["from"].GetType() == typeof(Color)) {
args["method"]="color";
}else{
Debug.LogError("iTween Error: ValueTo() only works with interpolating Vector3s, Vector2s, floats, ints, Rects and Colors!");
return;
}
//set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable:
if (!args.Contains("easetype")) {
args.Add("easetype",EaseType.linear);
}
Launch(target,args);
}
}