iTween基础之Rotate(旋转角度)

来源:互联网 发布:java素数的判断 编辑:程序博客网 时间:2024/06/16 19:36

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

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

一、基础介绍

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

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

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

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

  

RotateUpdate:类似于RotateTo

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

二、基础属性

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

[csharp] view plain copy
  1. void Start () {  
  2.      
  3.        //键值对儿的形式保存iTween所用到的参数  
  4.        Hashtable args = new Hashtable();  
  5.   
  6.        //旋转的角度  
  7.        args.Add("rotation"new Vector3(1, 100, 1));  
  8.        //args.Add("scale", msgNotContinue.transform);  
  9.        // x y z 旋转的角度  
  10.        args.Add("x", 100);  
  11.        args.Add("y", 1);  
  12.        args.Add("z", 1);  
  13.   
  14.        //是否使用局部角度(默认为false)  
  15.        args.Add("islocal"true);  
  16.        //动画的速度  
  17.        //args.Add("speed",10f);  
  18.        //动画的时间  
  19.        args.Add("time", 10f);  
  20.        //延迟执行时间  
  21.        args.Add("delay", 0.1f);  
  22.   
  23.        //这里是设置类型,iTween的类型又很多种,在源码中的枚举EaseType中  
  24.        args.Add("easeType", iTween.EaseType.easeInOutExpo);  
  25.        //三个循环类型 none loop pingPong (一般 循环 来回)     
  26.        //args.Add("loopType", "none");  
  27.        //args.Add("loopType", "loop");    
  28.        args.Add("loopType", iTween.LoopType.pingPong);  
  29.   
  30.        //处理移动过程中的事件。  
  31.        //开始发生动画时调用AnimationStart方法,5.0表示它的参数  
  32.        args.Add("onstart""AnimationStart");  
  33.        args.Add("onstartparams", 5.0f);  
  34.        //设置接受方法的对象,默认是自身接受,这里也可以改成别的对象接受,  
  35.        //那么就得在接收对象的脚本中实现AnimationStart方法。  
  36.        args.Add("onstarttarget", gameObject);  
  37.   
  38.   
  39.        //动画结束时调用,参数和上面类似  
  40.        args.Add("oncomplete""AnimationEnd");  
  41.        args.Add("oncompleteparams""end");  
  42.        args.Add("oncompletetarget", gameObject);  
  43.   
  44.        //动画中调用,参数和上面类似  
  45.        args.Add("onupdate""AnimationUpdate");  
  46.        args.Add("onupdatetarget", gameObject);  
  47.        args.Add("onupdateparams"true);  
  48.   
  49.        iTween.RotateTo(btnBegin, args);  
  50. }  
  51.      
  52.      
  53.    //动画开始时调用  
  54.    void AnimationStart(float f)  
  55.    {  
  56.        Debug.Log("start :" + f);  
  57.    }  
  58.    //动画结束时调用  
  59.    void AnimationEnd(string f)  
  60.    {  
  61.        Debug.Log("end : " + f);  
  62.    }  
  63.    //动画中调用  
  64.    void AnimationUpdate(bool f)  
  65.    {  
  66.        Debug.Log("update :" + f);  
  67.    }  
原创粉丝点击