iTween基础之Rotate(旋转角度)

一、基础介绍;二、基础属性

原文地址 :http://blog.csdn.net/dingkun520wy/article/details/50696489

 

一、基础介绍

 

RotateTo:旋转游戏物体到指定的角度。

 

 

RotateFrom:将游戏物体从给的角度旋转回原始角度

 

RotateAdd:对游戏物体的旋转角度随着时间,增加所提供的角度。

 

RotateBy:将提供的值乘以360,其余与RotateAdd相同。也就是提供的值为每个轴上旋转的周数.

 

 

RotateUpdate:类似于RotateTo

 ,在Update()方法或循环环境中调用。提供每帧改变属性值的环境。不依赖于EasrType.

 

二、基础属性

基础属性比较简单直接上代码

	void Start () {
    
        //键值对儿的形式保存iTween所用到的参数
        Hashtable args = new Hashtable();

        //旋转的角度
        args.Add("rotation", new Vector3(1, 100, 1));
        //args.Add("scale", msgNotContinue.transform);
        // x y z 旋转的角度
        args.Add("x", 100);
        args.Add("y", 1);
        args.Add("z", 1);

        //是否使用局部角度(默认为false)
        args.Add("islocal", true);
        //动画的速度
        //args.Add("speed",10f);
        //动画的时间
        args.Add("time", 10f);
        //延迟执行时间
        args.Add("delay", 0.1f);

        //这里是设置类型,iTween的类型又很多种,在源码中的枚举EaseType中
        args.Add("easeType", iTween.EaseType.easeInOutExpo);
        //三个循环类型 none loop pingPong (一般 循环 来回)	
        //args.Add("loopType", "none");
        //args.Add("loopType", "loop");	
        args.Add("loopType", iTween.LoopType.pingPong);

        //处理移动过程中的事件。
        //开始发生动画时调用AnimationStart方法,5.0表示它的参数
        args.Add("onstart", "AnimationStart");
        args.Add("onstartparams", 5.0f);
        //设置接受方法的对象,默认是自身接受,这里也可以改成别的对象接受,
        //那么就得在接收对象的脚本中实现AnimationStart方法。
        args.Add("onstarttarget", gameObject);


        //动画结束时调用,参数和上面类似
        args.Add("oncomplete", "AnimationEnd");
        args.Add("oncompleteparams", "end");
        args.Add("oncompletetarget", gameObject);

        //动画中调用,参数和上面类似
        args.Add("onupdate", "AnimationUpdate");
        args.Add("onupdatetarget", gameObject);
        args.Add("onupdateparams", true);

        iTween.RotateTo(btnBegin, args);
	}
    
    
    //动画开始时调用
    void AnimationStart(float f)
    {
        Debug.Log("start :" + f);
    }
    //动画结束时调用
    void AnimationEnd(string f)
    {
        Debug.Log("end : " + f);
    }
    //动画中调用
    void AnimationUpdate(bool f)
    {
        Debug.Log("update :" + f);
    }



posted @ 2016-02-19 11:18  乐逍遥Jun  阅读(2697)  评论(0编辑  收藏  举报