iTween.ScaleFrom C# (CSharp) Method

ScaleFrom() public static method

Instantly changes a GameObject's scale then returns it to it's starting scale over time with FULL customization options.
public static ScaleFrom ( GameObject target, Hashtable args ) : void
target GameObject
args Hashtable
return void
    public static void ScaleFrom(GameObject target, Hashtable args)
    {
        Vector3 tempScale;
        Vector3 fromScale;

        //clean args:
        args = iTween.CleanArgs(args);

        //set base fromScale:
        tempScale=fromScale=target.transform.localScale;

        //set augmented fromScale:
        if(args.Contains("scale")){
            if (args["scale"].GetType() == typeof(Transform)){
                Transform trans = (Transform)args["scale"];
                fromScale=trans.localScale;
            }else if(args["scale"].GetType() == typeof(Vector3)){
                fromScale=(Vector3)args["scale"];
            }
        }else{
            if (args.Contains("x")) {
                fromScale.x=(float)args["x"];
            }
            if (args.Contains("y")) {
                fromScale.y=(float)args["y"];
            }
            if (args.Contains("z")) {
                fromScale.z=(float)args["z"];
            }
        }

        //apply fromScale:
        target.transform.localScale = fromScale;

        //set new scale arg:
        args["scale"]=tempScale;

        //establish iTween:
        args["type"]="scale";
        args["method"]="to";
        Launch(target,args);
    }

Same methods

iTween::ScaleFrom ( GameObject target, Vector3 scale, float time ) : void
iTween