Unity-Tween
1、GoKit
免费开源
AssetStore:https://www.assetstore.unity3d.com/en/#!/content/3663
下载地址:https://github.com/prime31/GoKit
2、ITween
免费开源
官网:http://itween.pixelplacement.com/index.php
AssetStore:https://www.assetstore.unity3d.com/en/#!/content/84
下载地址:https://github.com/jtothebell/iTween
缺点:
- 大量使用SendMessage,而SendMessage使用反射,效率不高
- iTween的参数都是string,你需要自己去拼一个Hashtable,去记字符串,不人性化!每次写都要去它的官网上去查字符串怎么拼,挺蛋疼的!
3、LeanTween
免费开源
AssetStore:https://www.assetstore.unity3d.com/en/#!/content/3595
下载地址:https://github.com/dentedpixel/LeanTween
优点:貌似比Hotween和Itween性能好,快!参考:http://dentedpixel.com/developer-diary/leantween-speed-comparison-to-itween/
4、Hotween
免费开源
官网:http://hotween.demigiant.com/
AssetStore:https://www.assetstore.unity3d.com/en/#!/content/3311
下载地址:http://hotween.demigiant.com/
5、DOTween
这是Hotween官网出的,速度超过4倍更快,更高效,大量的新功能
下载地址:http://dotween.demigiant.com/download.php#download
Comparison with other engines
If you want, you can download the test package I used (oops sorry, I'll put it up there when I get into beta, otherwise I should update it every hour - but you can still get the most recent one from DOTween's Google Code area).
All these tests were done from a build, since some of these tween engines (DOTween, HOTween and GoKit) do additional stuff while in the Editor to show editor-only debug informations, and thus testing them outside the editor, where it counts, seemed more fair.
To keep the test accurate download the latest versions of all engines and replace the old ones (the ones used here are from July/August 2014).
Generic floats
You'll find more tests for the tween of generic floats because GoKit and iTween couldn't tween as many as the other engines, but I still wanted to show high-level results.
64,000 generic floats in a loop
| DOTween | HOTween | LeanTween | GoKit | iTween | |
|---|---|---|---|---|---|
| Average FPS | 124 FPS | 25 FPS | 102 FPS | freezes | freezes |
| Startup time | 76 MS | 332 MS | 34 MS | freezes | freezes |
16,000 generic floats in a loop
| DOTween | HOTween | LeanTween | GoKit | iTween | |
|---|---|---|---|---|---|
| Average FPS | 412 FPS | 115 FPS | 389 FPS | 387 FPS | freezes |
| Startup time | 14 MS | 74 MS | 7 MS | 47,432 MS | freezes |
2,000 generic floats in a loop
| DOTween | HOTween | LeanTween | GoKit | iTween | |
|---|---|---|---|---|---|
| Average FPS | 1091 FPS | 888 FPS | 1050 FPS | 998 FPS | 3 FPS |
| Startup time | 2 MS | 11 MS | 1 MS | 6,258 MS | 240 MS |
Transforms
4,000 transforms looping around
| DOTween | HOTween | LeanTween | GoKit | iTween | |
|---|---|---|---|---|---|
| Average FPS | 68 FPS | 63 FPS | 68 FPS | 65 FPS | 38 FPS |
| Startup time | 5 MS | 30 MS | 3 MS | 130 MS | 229 MS |
实现人物沿四个点移动,实现这同一效果,代码分别为:

public class MyDotween : MonoBehaviour
{
public Transform[] paths;
void Start()
{
Vector3[] v = new Vector3[];
for (int i = ; i < paths.Length; i++)
{
v[i] = paths[i].position;
}
transform.DOPath(v, 3f, PathType.Linear).SetLookAt(-).SetDelay(1f).SetEase(Ease.Linear).OnComplete(ItweenAnimationEnd);
}
//对象移动时调用
void ItweenAnimationEnd()
{
Debug.Log("end : ");
}
}
Dotween
public class MyLeanTween : MonoBehaviour
{
public Transform[] paths;
void Start()
{
//四个点的话,那么应该是这样确定点的位置,并且数组长度必须是4的倍数:
// O(对象自己的位置)->A A->B B->C C->D
Vector3[] v = new Vector3[];
v[] = transform.position;
for (int i = ; i < paths.Length; i++)
{
v[i * + ] = paths[i].position;
if (i == )
continue;
v[i * + ] = paths[i].position;
}
Hashtable args = new Hashtable();
args.Add("path", v);
//是否让模型始终面朝当面目标的方向
args.Add("orientToPath", true);
//移动结束时调用,参数和上面类似
args.Add("onComplete", "LeanAnimationEnd");
args.Add("onCompleteParam", "zwh");
//设置类型为线性,线性效果会好一些。
args.Add("loopType", LeanTweenType.linear);
//设置延迟
args.Add("delay", 1f);
//设置循环
args.Add("repeat", );
LeanTween.move(gameObject, v, 3f, args);
}
//对象移动时调用
void LeanAnimationEnd(object obj)
{
Debug.Log("end : " + obj);
}
}
LeanTween
public class MyGoKit : MonoBehaviour
{
public Transform[] paths;
void Start()
{
Vector3[] v = new Vector3[];
v[] = transform.position;//设置自身的位置为第一个位置,因为没有像ITween中的movetopath选项可以设置
for (int i = ; i < paths.Length; i++)
{
v[i + ] = paths[i].position;
}
GoTweenConfig config = new GoTweenConfig();
//设置路径的点
var path = new GoSpline(v, true);
//设置类型为线性,线性效果会好一些。
config.easeType = GoEaseType.Linear;
//GoLookAtType.NextPathNode是和ITween的orienttopath设置功能是一样的
config.positionPath(path, false, GoLookAtType.NextPathNode);
//设置循环
config.setIterations();
config.onComplete(delegate(AbstractGoTween obj)
{
Debug.Log("end : " + obj);
}); //这里to方法的第一个参数必须传transform类型的变量,不然报错
Go.to(gameObject.transform, 3f, config);
} void OnDrawGizmos()
{
//在scene视图中绘制出路径与线
iTween.DrawLine(paths, Color.yellow); iTween.DrawPath(paths, Color.red);
}
}
GoKit
public class MyHotween : MonoBehaviour
{
public Transform[] paths;
void Start()
{
Vector3[] v = new Vector3[];
for (int i = ; i < paths.Length; i++)
{
v[i] = paths[i].position;
}
TweenParms tp = new TweenParms();
tp.Delay(1f);
tp.Loops();
tp.OnComplete(PathCycleComplete, "zwh");
tp.Ease(EaseType.Linear);
PlugVector3Path p = new PlugVector3Path(v, PathType.Linear);
p.OrientToPath(true);
tp.Prop("position", p);
HOTween.To(gameObject.transform, , tp); } void PathCycleComplete(TweenEvent abc)
{
Debug.Log("end : " + abc.parms[]);
}
}
Hotween
public class MyItween : MonoBehaviour
{
//路径寻路中的所有点
public Transform[] paths; void Start()
{
Hashtable args = new Hashtable();
//设置路径的点
args.Add("path", paths); //设置类型为线性,线性效果会好一些。
args.Add("easeType", iTween.EaseType.linear); //设置寻路的速度
args.Add("speed", 6f); //是否先从原始位置走到路径中第一个点的位置
args.Add("movetopath", true); //是否让模型始终面朝当面目标的方向
//如果你发现你的模型在寻路的时候时钟都是一个方向那么一定要打开这个
args.Add("orienttopath", true); //移动结束时调用,参数和上面类似
args.Add("oncomplete", "ItweenAnimationEnd");
args.Add("oncompleteparams", "zwh");
args.Add("oncompletetarget", gameObject); //让模型开始寻路
iTween.MoveTo(gameObject, args);
}
//对象移动时调用
void ItweenAnimationEnd(string f)
{
Debug.Log("end : " + f);
}
void OnDrawGizmos()
{
//在scene视图中绘制出路径与线
iTween.DrawLine(paths, Color.yellow); iTween.DrawPath(paths, Color.red);
}
}
Itween
总结:
从以上分析,Dotween和Leantween效率比较好,但是从代码角度看,Dotween代码可读性强,体现了面向对象的思想,而Leantween仍然要死记字符串!
参考:http://www.xuanyusong.com/archives/2671
http://dotween.demigiant.com/index.php
Unity-Tween的更多相关文章
- iTween for Unity
你曾经在你的游戏中制作过动画吗?问这个问题可能是愚蠢的,几乎每个Game都有动画,虽然有一些没有,但你必须处理有动画和没有动画.让我们结识 ITween. iTween 官方网站:http://itw ...
- 【转】iTween for Unity
http://www.cnblogs.com/zhaoqingqing/p/3833321.html?utm_source=tuicool&utm_medium=referral 你曾经在你的 ...
- Unity NGUI Tween的用法
unity版本:4.5 NGUI版本:3.6.5 参考链接:http://www.colabug.com/thread-1029974-1-1.html,作者:COLABUG.COM 橘虞 htt ...
- Unity该插件NGUI得知(9)—— Tween并转换成世界坐标系的大小NGUI尺寸
在游戏中,还有一种比较常见的动画,这是进球后产生,分数将被显示在游戏,而快速移动,使其失去位置加入.就打算使用NGUI的Tween来制作这样的分数动画效果. 依据 Unity插件之NGUI学习(2), ...
- Unity NGUI Tween动画回调不执行问题
最近工作中遇到了一个问题 NGUI的Tween动画完成 回调函数 偶尔不执行 偶现Bug 今天我仔细看了下代码发现 TweenPosition tempTween = varTar.GetCompon ...
- 关于Unity中NGUI的帧动画和Tween动画
帧动画 1.把三张帧动画的贴图png制作成图集,NGUI---->Open---->Atlas Maker,生成一个预制体,一个材质球,一个大图 2.创建一个Sprite类型的Sprite ...
- 【Unity3D基础教程】给初学者看的Unity教程(零):如何学习Unity3D
作者:王选易,出处:http://www.cnblogs.com/neverdie/ 欢迎转载,也请保留这段声明.如果你喜欢这篇文章,请点推荐.谢谢! Unity3D有什么优势 Unity3D是一个跨 ...
- Unity开发之NGUI系列
Unity插件收集 在Unity开发过程中会收集一些插件,收集这些插件的目的并不是我喜欢在开发中使用插件,而是本着喜欢的态度去收集的,就像我喜欢收集模型一样: 还有一点就是通过了解插件能让我知道Uni ...
- C#程序员整理的Unity 3D笔记(十五):Unity 3D UI控件至尊–NGUI
目前,UGUI问世不过半年(其随着Unity 4.6发布问世),而市面上商用的产品,UI控件的至尊为NGUI:影响力和广度(可搜索公司招聘Unity 3D,常常能看到对NGUI关键词). NGUI虽然 ...
- Unity 通过Animation实现控件位置的转换
Unity版本:4.5.1 NGUI版本:3.6.5 参考链接:http://blog.csdn.net/unity3d_xyz/article/details/23035521,作者:CSDN in ...
随机推荐
- DotNet二维码操作组件ThoughtWorks.QRCode
DotNet二维码操作组件ThoughtWorks.QRCode 在生活中有一种东西几乎已经快要成为我们的另一个电子"身份证",那就是二维码.无论是在软件开发的过程中,还是在普通用 ...
- U3D临时文件GICache巨大
C:\Users\asus\AppData\LocalLow\Unity\Caches\GiCache 看名字似乎是全局光的缓存,可以通过Edit - Preference - GI Cache,选中 ...
- Silverlight自定义控件开发:仪表盘
在项目中,由于使用到了活动积温运算,也就是指当日平均气温稳定上升到10℃以上时,大多数农作物才能活跃生长.把大于等于10℃持续期内的日平均气温累加起来,得到的气温总和,叫做活动积温.所以我决定采用do ...
- 【插件开发】—— 1 Eclipse插件开发导盲
[插件开发]—— 1 Eclipse插件开发导盲 在真正接触eclipse插件开发一个月后,对插件的开发过程以及技术要求,也有了一定的了解.遥想之前像无头苍蝇一样乱撞乱学,真心觉得浪费了不少时间. ...
- 云计算之路-阿里云上:2014年6月12日12点IIS请求到达量突降
今天中午12:00左右,在Windows性能监视器中突然发现SLB中的两台云服务器的IIS请求到达量(ArriveRate)突然下降,见下图: IIS日志中的情况如下: 综合以上情况,我们推测在12: ...
- 第一章 OO大智慧
今天,正式开始读王涛写的<你必须知道的.NET(第二版)>,刚开始读了序,觉得写的相当精彩,就被吸引住了.看了一会发现本书的特点可能就是以例举例,形象生动,比较期待的样子.虽然前面讲的概念 ...
- 疯狂的Java算法——插入排序,归并排序以及并行归并排序
从古至今的难题 在IT届有一道百算不厌其烦的题,俗称排序.不管是你参加BAT等高端笔试,亦或是藏匿于街头小巷的草根笔试,都会经常见到这样一道百年难得一解的问题. 今天LZ有幸与各位分享一下算法届的草根 ...
- AE 打开各种格式文件
http://blog.sina.com.cn/s/blog_7a3fc90501016qrg.html /// <summary>/// 打开ShapeFile文件/// </su ...
- [wikioi2069]油画(贪心)
题目:http://www.wikioi.com/problem/2069/ 分析: 首先这个问题比较复杂,涉及到两个重要的考虑点,一个是当前拿来的颜色是否保留,一个是若保留后那么应该把当前盘子的哪个 ...
- 编写高质量代码改善C#程序的157个建议[10-12]
前言 本文已更新至http://www.cnblogs.com/aehyok/p/3624579.html .本文主要学习记录以下内容: 建议10.创建对象时需要考虑是否实现比较器 建议11.区别对待 ...