iTween.ScaleUpdate C# (CSharp) Method

ScaleUpdate() public static method

Similar to ScaleTo but incredibly less expensive for usage inside the Update function or similar looping situations involving a "live" set of changing values with FULL customization options. Does not utilize an EaseType.
public static ScaleUpdate ( GameObject target, Hashtable args ) : void
target GameObject
args Hashtable
return void
    public static void ScaleUpdate(GameObject target, Hashtable args)
    {
        CleanArgs(args);

        float time;
        Vector3[] vector3s = new Vector3[4];

        //set smooth time:
        if(args.Contains("time")){
            time=(float)args["time"];
            time*=Defaults.updateTimePercentage;
        }else{
            time=Defaults.updateTime;
        }

        //init values:
        vector3s[0] = vector3s[1] = target.transform.localScale;

        //to values:
        if (args.Contains("scale")) {
            if (args["scale"].GetType() == typeof(Transform)){
                Transform trans = (Transform)args["scale"];
                vector3s[1]=trans.localScale;
            }else if(args["scale"].GetType() == typeof(Vector3)){
                vector3s[1]=(Vector3)args["scale"];
            }
        }else{
            if (args.Contains("x")) {
                vector3s[1].x=(float)args["x"];
            }
            if (args.Contains("y")) {
                vector3s[1].y=(float)args["y"];
            }
            if (args.Contains("z")) {
                vector3s[1].z=(float)args["z"];
            }
        }

        //calculate:
        vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time);
        vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time);
        vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time);

        //apply:
        target.transform.localScale=vector3s[3];
    }

Same methods

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