iTween.RotateFrom C# (CSharp) Method

RotateFrom() public static method

Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time (if allowed) with FULL customization options.
public static RotateFrom ( GameObject target, Hashtable args ) : void
target GameObject
args Hashtable
return void
    public static void RotateFrom(GameObject target, Hashtable args)
    {
        Vector3 tempRotation;
        Vector3 fromRotation;
        bool tempIsLocal;

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

        //set tempIsLocal:
        if(args.Contains("islocal")){
            tempIsLocal = (bool)args["islocal"];
        }else{
            tempIsLocal = Defaults.isLocal;
        }

        //set tempRotation and base fromRotation:
        if(tempIsLocal){
            tempRotation=fromRotation=target.transform.localEulerAngles;
        }else{
            tempRotation=fromRotation=target.transform.eulerAngles;
        }

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

        //apply fromRotation:
        if(tempIsLocal){
            target.transform.localEulerAngles = fromRotation;
        }else{
            target.transform.eulerAngles = fromRotation;
        }

        //set new rotation arg:
        args["rotation"]=tempRotation;

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

Same methods

iTween::RotateFrom ( GameObject target, Vector3 rotation, float time ) : void
iTween