UNITY之iTween
2016-08-25 20:32
471 查看
using UnityEngine;
using System.Collections;
public class Move : MonoBehaviour {
public Texture2D textsure;
public Vector3[] vecs;
// Use this for initialization
void Start () {
//iTween.MoveTo (this.gameObject,Vector3.up*5,3);
//iTween.MoveTo (this.gameObject,iTween.Hash("time",5,"x",10,"looptype",iTween.LoopType.pingPong,"oncomplete","OnAnimationComplete"));
Hashtable hash = new Hashtable ();
hash.Add ("time",5);
hash.Add ("x",10);
hash.Add ("looptype",iTween.LoopType.pingPong);
hash.Add ("oncomplete","OnAnimationComplete");
hash.Add ("easetype",iTween.EaseType.easeInExpo);
//hash.Add ("oncompleteparams","nihao");给OnAnimationComplete(string<
4000
span style="color:#888888;"> msg)方法传递参数
iTween.MoveTo (this.gameObject,hash);
//iTween.ColorTo (this.gameObject,iTween.Hash("r",0,"g",255,"b",0,"includechildren",true));//从原来颜色变换为目标颜色
//iTween.ColorFrom (this.gameObject,Color.black,3);//从此颜色变换回原来颜色
//iTween.CameraFadeAdd (textsure);//必须添加一张2d纹理
//iTween.CameraFadeFrom (1,3);//摄像机的透明度从1到0
//iTween.CameraFadeTo (1,3);//摄像机的透明度从0到1
//iTween.ScaleTo (this.gameObject,iTween.Hash("time",3,"x",5));
//iTween.PunchPosition (this.gameObject,iTween.Hash("time",2,"x",2,"y",2));
//iTween.ShakePosition (this.gameObject,iTween.Hash("time",5,"x",2,"y",2));
}
void OnDrawGizmos(){
iTween.DrawLine (vecs,Color.red);//绘制一条线链接Vector3[] vecs中的各点;
//iTween.DrawPath (vecs,Color.red);//绘制一条路径链接Vector3[] vecs中的各点
}
// Update is called once per frame
void Update () {
//iTween.MoveUpdate (this.gameObject,Vector3.up*Time.deltaTime,2);
}
void OnAnimationComplete(){
print ("nihao OnAnimationComplete");
}
// void OnAnimationComplete(string msg){
// print (msg);
//
b65e
}
}
using UnityEngine;
using System.Collections;
public class RotateDemo : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
//looktarget:朝向的目标物体,path:运行轨道
iTween.MoveTo (this.gameObject,iTween.Hash("time",10,"looktarget",target.transform,"path",iTweenPath.GetPath("New Path 1"),
"oncomplete","method","easetype",iTween.EaseType.easeInExpo
));
}
// Update is called once per frame
void Update () {
}
void method(){//主要用来对摄像机的复原
}
}
using System.Collections;
public class Move : MonoBehaviour {
public Texture2D textsure;
public Vector3[] vecs;
// Use this for initialization
void Start () {
//iTween.MoveTo (this.gameObject,Vector3.up*5,3);
//iTween.MoveTo (this.gameObject,iTween.Hash("time",5,"x",10,"looptype",iTween.LoopType.pingPong,"oncomplete","OnAnimationComplete"));
Hashtable hash = new Hashtable ();
hash.Add ("time",5);
hash.Add ("x",10);
hash.Add ("looptype",iTween.LoopType.pingPong);
hash.Add ("oncomplete","OnAnimationComplete");
hash.Add ("easetype",iTween.EaseType.easeInExpo);
//hash.Add ("oncompleteparams","nihao");给OnAnimationComplete(string<
4000
span style="color:#888888;"> msg)方法传递参数
iTween.MoveTo (this.gameObject,hash);
//iTween.ColorTo (this.gameObject,iTween.Hash("r",0,"g",255,"b",0,"includechildren",true));//从原来颜色变换为目标颜色
//iTween.ColorFrom (this.gameObject,Color.black,3);//从此颜色变换回原来颜色
//iTween.CameraFadeAdd (textsure);//必须添加一张2d纹理
//iTween.CameraFadeFrom (1,3);//摄像机的透明度从1到0
//iTween.CameraFadeTo (1,3);//摄像机的透明度从0到1
//iTween.ScaleTo (this.gameObject,iTween.Hash("time",3,"x",5));
//iTween.PunchPosition (this.gameObject,iTween.Hash("time",2,"x",2,"y",2));
//iTween.ShakePosition (this.gameObject,iTween.Hash("time",5,"x",2,"y",2));
}
void OnDrawGizmos(){
iTween.DrawLine (vecs,Color.red);//绘制一条线链接Vector3[] vecs中的各点;
//iTween.DrawPath (vecs,Color.red);//绘制一条路径链接Vector3[] vecs中的各点
}
// Update is called once per frame
void Update () {
//iTween.MoveUpdate (this.gameObject,Vector3.up*Time.deltaTime,2);
}
void OnAnimationComplete(){
print ("nihao OnAnimationComplete");
}
// void OnAnimationComplete(string msg){
// print (msg);
//
b65e
}
}
using UnityEngine;
using System.Collections;
public class RotateDemo : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
//looktarget:朝向的目标物体,path:运行轨道
iTween.MoveTo (this.gameObject,iTween.Hash("time",10,"looktarget",target.transform,"path",iTweenPath.GetPath("New Path 1"),
"oncomplete","method","easetype",iTween.EaseType.easeInExpo
));
}
// Update is called once per frame
void Update () {
}
void method(){//主要用来对摄像机的复原
}
}
相关文章推荐
- Unity NGUI内特效与UI层级关系的设置
- Unity IOC + MVC 实例需要手动释放吗?
- UnityEffects(3)之闪电链
- Unity中批处理对Shader的影响
- unity开发shader中要用到的内置状态变量(二)
- Unity5中新的Shader体系简析
- unity小地图制作和方向导航
- Unity Shader 常用函数列表
- unity开发shader中要用到的内置状态变量(一)
- 猫都能学会的Unity3D Shader入门指南(二)
- 猫都能学会的Unity3D Shader入门指南(一)
- Unity3D —— Socket通信(C#)
- unity Animator 怎么判断一个动画播放结束
- unity3D 如何提取游戏资源 (反编译)+代码反编译【P.M.出品】
- 构建ASP.NET MVC5+EF6+EasyUI 1.4.3+Unity4.x注入的后台管理系统(62)-EF链接串加密
- Unity5中优化VR 应用的12个技巧
- unity中的meta和mainfest文件
- unity 中将c#打包成dll中,需要注意的地方
- UNITY之技能CD脚本
- [Unity]打包遇到Too many method references when I export android build解决方法