1,五种移动方法;2, 函数的基础属性及用法
iTween官网:http://itween.pixelplacement.com/index.php
1,五种移动方法
MoveTo:从原始位置移动到目标位置。
MoveFrom:从目标位置移动到原始位置。
MoveAdd:随时间移动游戏对象的位置,根据提供的量。
MoveBy:增加提供的坐标到游戏对象的位置。(与MoveAdd一样)
MoveUpdate:类似于MoveTo,在Update()或FixedUpdate()方法或循环环境中调用。提供每帧改变属性值的环境。不依赖于EasrType.
动画的方法一般有两种重载,
a,最小定制选项,只需要提供最少必需参数
//target:要移动的物体;position:要移动的位置;time:动画的运行的时间
public static void MoveUpdate(GameObject target, Vector3 position, float time);
b,完全定制选项,可定制所有的参数
//target:要移动的物体;args:定制的数组
public static void MoveUpdate(GameObject target, Hashtable args);
2, 函数的基础属性及用法
基础属性比较简单直接上代码
- void Start () {
-
-
- Hashtable args = new Hashtable();
-
-
-
- args.Add("easeType", iTween.EaseType.easeInOutExpo);
-
-
-
-
- args.Add("time",10f);
-
- args.Add("NamedValueColor","_SpecColor");
-
- args.Add("delay", 0.1f);
-
-
- args.Add("orienttopath", true);
-
- args.Add("looktarget",Vector3.zero);
-
- args.Add("looktime",1.1);
-
-
-
- Vector3[] testPath = { new Vector3(0, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 1), new Vector3(1, 1, 1), new Vector3(1, 5, 1) };
- args.Add("path", testPath);
-
- args.Add("movetopath", false);
-
-
- args.Add("lookahead",0.01);
-
-
- args.Add("axis", "x");
-
- args.Add("islocal", false);
-
-
-
-
-
- args.Add("loopType", iTween.LoopType.pingPong);
-
-
-
- args.Add("onstart", "AnimationStart");
- args.Add("onstartparams", 5.0f);
-
-
- 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);
-
-
- args.Add("x",-5);
- args.Add("y",1);
- args.Add("z",1);
-
-
-
- iTween.MoveTo(btnBegin, args);
- }
-
- void AnimationUpdate(bool f)
- {
- Debug.Log("update :" + f);
- }
-
- void AnimationStart(float f)
- {
- Debug.Log("start :" + f);
- }
-
- void AnimationEnd(string f)
- {
- Debug.Log("end : " + f);
- }