doblendablerotateby旋转相机评测do位置为什么会晃

16529人阅读
Unity(80)
DOTween 使用方法
using UnityE
using System.C
using DG.T
using UnityEngine.UI;
public class TestDoTween : MonoBehaviour {
int number = 0;
void Start ()
FunctionSet();
#region 方法一 类方法
private void FunctionOne()
Tween tween = DOTween.To(() =& transform.position, r =& transform.position = r, new Vector3(5, 5, 5), 1);
Tween t = DOTween.To(() =& number, x =& number = x, 100, 5);
t.OnUpdate( () =& UpdateTween(number));
private void UpdateTween(int num)
Debug.Log(num);
#endregion
#region 方法二
private void FunctionTwo()
#endregion
#region DOTween回调方法
以 On 开头
private void CallBack()
Tween t = DOTween.To(() =& number, x =& number = x, 100, 5);
t.OnStart(OnStartTween).OnKill(OnKill).OnPause(OnPause).OnPlay(OnPlay).OnRewind(OnRewind);
t.OnStepComplete(OnStepComplete).OnUpdate(UpdateTweenEd).OnComplete(OnComplete);
t.OnUpdate(() =& UpdateTweenED(number));
private void UpdateTweenED(int num)
Debug.Log("num
private void OnComplete()
Debug.Log("OnComplete");
private void OnKill()
Debug.Log("OnKill");
private void OnPlay()
Debug.Log("OnPlay");
private void OnPause()
Debug.Log("OnPause");
private void OnRewind()
Debug.Log("OnRewind");
private void OnStartTween()
Debug.Log("StartTween");
private void OnStepComplete()
Debug.Log("OnStepComplete");
private void UpdateTweenEd()
Debug.Log(number);
private void OnWayPointChange()
Debug.Log("OnWayPointChange");
#endregion
#region Set 方法
private void FunctionSet()
Vector3 pos = Vector3.
Tween tween = DOTween.To(() =& pos, r =& pos = r, new Vector3(5, 5, 5), 1).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutCirc);
Tween t = DOTween.To(() =& transform.position, r =& transform.position = r, new Vector3(15, 15, 15), 2).SetAs(tween);
transform.DOMoveX(20, 5).SetAutoKill(true).SetDelay(3).SetEase(Ease.InOutCirc)
.SetId("superTween").SetLoops( -1, LoopType.Yoyo).SetRecyclable()
.SetRelative().SetSpeedBased().SetTarget(transform).SetUpdate(UpdateType.Normal, true);
#endregion
#region Sequence 队列
private void FunctionSequence()
float duration = 5;
Sequence s = DOTween.Sequence();
s.Append(transform.DOMoveX(6, 3).SetRelative().SetEase(Ease.InOutQuad));
s.Insert(0, transform.DORotate(new Vector3(0, 45, 0), duration / 2).SetEase(Ease.InQuad).SetLoops(100, LoopType.Yoyo));
s.Insert(duration / 2, transform.GetComponent&Renderer&().material.DOColor(Color.yellow, duration / 2));
s.SetLoops(-1, LoopType.Yoyo);
#endregion
#region 设置冷却转圈的 Image
public Image dotweenLogo, circleO
private void FunctionImageCollDown()
circleOutline = GetComponent&Image&();
if (circleOutline == null)
circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear).Pause();
circleOutline.DOFillAmount(0, 1.5f).SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo)
.OnStepComplete(() =&
circleOutline.fillClockwise = !circleOutline.fillC
circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear);
dotweenLogo = GetComponent&Image&();
if (dotweenLogo == null)
dotweenLogo.DOFade(0, 1.5f).SetAutoKill(false).Pause();
private Color RandomColor()
return new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1);
#endregion
#region 设置 Text 的跑马字,一秒显示 N 个字
public Text text, relativeText, scrambledT
private void FunctionText()
text = GetComponent&Text&();
text.DOText("This text will replace the existing one", 2).SetEase(Ease.Linear).SetAutoKill(false).Pause();
relativeText = GetComponent&Text&();
relativeText.DOText(" - This text will be added to the existing one", 2).SetRelative().SetEase(Ease.Linear).SetAutoKill(false).Pause();
scrambledText = GetComponent&Text&();
scrambledText.DOText("This text will appear from scrambled chars", 2, true).SetEase(Ease.Linear).SetAutoKill(false).Pause();
#endregion
private void FunctionSlider()
slider = GetComponent&Slider&();
slider.DOValue(1, 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause();
#endregion
private void FunctionDOTween()
DOTween.PlayAll();
DOTween.RestartAll();
#endregion
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:381196次
积分:5834
积分:5834
排名:第4713名
原创:218篇
评论:57条
(1)(1)(3)(5)(13)(4)(1)(3)(7)(13)(1)(9)(11)(11)(7)(130)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'DoTween使用方法1
我的图书馆
DoTween使用方法1
using UnityEusing System.Cusing DG.Tusing UnityEngine.UI;public class TestDoTween : MonoBehaviour {&&& int number = 0;&&& &&& void Start ()&&& {&&&&&&& &&&&&&& &&&&&&& &&&&&&& FunctionSet();&&& }&&& &&& #region 方法一 类方法&&& private void FunctionOne()&&& {&&&&&&& &&&&&&& Tween tween = DOTween.To(() =& transform.position, r =& transform.position = r, new Vector3(5, 5, 5), 1);&&&&&&& &&&&&&& Tween t = DOTween.To(() =& number, x =& number = x, 100, 5);&&&&&&& &&&&&&& t.OnUpdate( () =& UpdateTween(number));& &&& }&&& private void UpdateTween(int num)&&& {&&&&&&& Debug.Log(num);&&&&& &&& }&&& #endregion&&& #region 方法二& 直接调用&&& private void FunctionTwo()&&& {&&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&& }&&& #endregion&&& #region DOTween回调方法& 以 On 开头&&& private void CallBack()&&& {&&&&&&& &&&&&&& Tween t = DOTween.To(() =& number, x =& number = x, 100, 5);&&&&&&& &&&&&&& &&&&&&& &&&&&&& t.OnStart(OnStartTween).OnKill(OnKill).OnPause(OnPause).OnPlay(OnPlay).OnRewind(OnRewind);&&&&&&& t.OnStepComplete(OnStepComplete).OnUpdate(UpdateTweenEd).OnComplete(OnComplete);&&&&&&& &&&&&&& t.OnUpdate(() =& UpdateTweenED(number));&&& }&&& private void UpdateTweenED(int num)&&& {&&&&&&& Debug.Log("num&& " + num);&&& }&&& private void OnComplete()&&& {&&&&&&& Debug.Log("OnComplete"); &&& }&&& private void OnKill()&&& {&&&&&&& Debug.Log("OnKill");&& &&& }&&& private void OnPlay()&&& {&&&&&&& Debug.Log("OnPlay");&& &&& }&&& private void OnPause()&&& {&&&&&&& Debug.Log("OnPause");& &&& }&&& private void OnRewind()&&& {&&&&&&& Debug.Log("OnRewind");&& &&& }&&& private void OnStartTween()&&& {&&&&&&& Debug.Log("StartTween"); &&& }&&& private void OnStepComplete()&&& {&&&&&&& Debug.Log("OnStepComplete");& &&& }&&& private void UpdateTweenEd()&&& {&&&&&&& Debug.Log(number);&&&&& &&& }&&& private void OnWayPointChange()&&& {&&&&&&& Debug.Log("OnWayPointChange");& &&& }&&& #endregion&&& #region Set 方法&&& private void FunctionSet()&&& {&&&&&&& Vector3 pos = Vector3.&&&&&&& &&&&&&& Tween tween = DOTween.To(() =& pos, r =& pos = r, new Vector3(5, 5, 5), 1).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.InOutCirc);&&&&&&& &&&&&&& &&&&&&& Tween t = DOTween.To(() =& transform.position, r =& transform.position = r, new Vector3(15, 15, 15), 2).SetAs(tween);&&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& &&&&&&& transform.DOMoveX(20, 5).SetAutoKill(true).SetDelay(3).SetEase(Ease.InOutCirc)&&&&&&&&&&& .SetId("superTween").SetLoops( -1, LoopType.Yoyo).SetRecyclable()&&&&&&&&&&& .SetRelative().SetSpeedBased().SetTarget(transform).SetUpdate(UpdateType.Normal, true);&&& }&&& #endregion&&& #region Sequence 队列&&& private void FunctionSequence()&&& {&&&&&&& float duration = 5; &&&&&&& Sequence s = DOTween.Sequence();&&&&&&& &&&&&&& s.Append(transform.DOMoveX(6, 3).SetRelative().SetEase(Ease.InOutQuad));&&&&&&& &&&&&&& &&&&&&& s.Insert(0, transform.DORotate(new Vector3(0, 45, 0), duration / 2).SetEase(Ease.InQuad).SetLoops(100, LoopType.Yoyo));&&&&&&& &&&&&&& s.Insert(duration / 2, transform.GetComponent&Renderer&().material.DOColor(Color.yellow, duration / 2));&&&&&&& &&&&&&& s.SetLoops(-1, LoopType.Yoyo);&&& }&&& #endregion&&& #region 设置冷却转圈的 Image&&& public Image dotweenLogo, circleO&&& private void FunctionImageCollDown()&&& {&&&&&&& circleOutline = GetComponent&Image&();&&&&&&& if (circleOutline == null)&&&&&&&&&&& return;&&&&&&& &&&&&&& circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear).Pause();&&&&&&& &&&&&&& circleOutline.DOFillAmount(0, 1.5f).SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo)&&&&&&&&&&& .OnStepComplete(() =&&&&&&&&&&&& {&&&&&&&&&&&&&&& circleOutline.fillClockwise = !circleOutline.fillC&&&&&&&&&&&&&&& circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear);&&&&&&&&&&& })&&&&&&&&&&& .Pause();&&&&&&& dotweenLogo = GetComponent&Image&();&&&&&&& if (dotweenLogo == null)&&&&&&&&&&& return;&&&&&&& &&&&&&& dotweenLogo.DOFade(0, 1.5f).SetAutoKill(false).Pause();&&& }&&& private Color RandomColor()&&& {&&&&&&& return new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1);&&& }&&& #endregion&&& #region 设置 Text 的跑马字,一秒显示 N 个字&&& public Text text, relativeText, scrambledT&&& private void FunctionText()&&& {&&&&&&& text = GetComponent&Text&();&&&&&&& &&&&&&& text.DOText("This text will replace the existing one", 2).SetEase(Ease.Linear).SetAutoKill(false).Pause();&&&&&&& relativeText = GetComponent&Text&();&&&&&&& &&&&&&& relativeText.DOText(" - This text will be added to the existing one", 2).SetRelative().SetEase(Ease.Linear).SetAutoKill(false).Pause();&&&&&&& scrambledText = GetComponent&Text&();&&&&&&& &&&&&&& scrambledText.DOText("This text will appear from scrambled chars", 2, true).SetEase(Ease.Linear).SetAutoKill(false).Pause();&&& }&&& #endregion&&& #region& Slider&&& public S&&& private void FunctionSlider()&&& {&&&&&&& slider = GetComponent&Slider&();&&&&&&& slider.DOValue(1, 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause();&&& }&&& #endregion&&& #region &&& private void FunctionDOTween()&&& {&&&&&&& DOTween.PlayAll();& &&&&&&& DOTween.RestartAll();& &&& }&&& #endregion}
TA的最新馆藏
喜欢该文的人也喜欢DOTween&使用方法
UnityEngine.UI;
TestDoTween : MonoBehaviour {
// Use this for initialization
Start () {
//FunctionOne();
//FunctionTwo();
//FunctionSequence();
FunctionSet(); }
// 创建 DOTween 实例 方法
#region 方法一 类方法
FunctionOne()
// 创建一个 Tweener 是自身坐标 一秒内 移动到 坐标 Vector3(5, 5, 5) 位置
Tween tween = DOTween.To(() =& transform.position, r =&
transform.position = r,
Vector3(5,
// 创建一个 Tweener 对象, 另 number的值在 5 秒内变化到 100
Tween t = DOTween.To(() =& number, x =& number = x,
// 给执行 t 变化时,每帧回调一次 UpdateTween 方法
t.OnUpdate( () =& UpdateTween(number)); }
UpdateTween(int
num) { Debug.Log(num);
// 变化过程中, 每帧回调该方法
#endregion
#region 方法二 直接调用
FunctionTwo()
//十秒内X,Y,Z 局部坐标(localPosition)移动到 10,10,10 位置
//transform.DOBlendableLocalMoveBy(new Vector3(10, 10, 10),
//十秒内 X,Y,Z 方向的局部旋转(localPosition),转动到 30,30,30
//transform.DOBlendableLocalRotateBy(new Vector3(30, 30, 30),
//十秒内X,Y,Z坐标移动到 自身坐标 加 new Vector3( 10,10,10) 位置 原始 坐标 3,3,3,移动后
13,13,13
//transform.DOBlendableMoveBy(new Vector3(10, 10, 10), 10);
//十秒内X,Y,Z自身旋转到 30,30,30(有父物体的相对于父物体)
//transform.DOBlendableRotateBy(new Vector3(30, 30, 30),
//十秒内 自身X,Y,Z方向的比例 加 3,3,3如原始比例 2,1,1 变化后5,4,4
//transform.DOBlendableScaleBy(new Vector3(10, 10, 10), 10);
//执行该方法,变化立即结束,且完成移动
//transform.DOComplete();
//在变化过程中执行该方法,则物体慢慢的变回原样,如果变化已经完成,该方法无效
//transform.DOFlip();
// 变化过程中执行该方法,则物体变化到 第二秒 时该物体的位置、比例等
//transform.DOGoto(2);
//十秒内 弹跳 3次
//transform.DOJump(new Vector3(10, 10, 10), 3, 10);
//停止掉当前的变化
//transform.DOKill();
// 十秒内 弹跳 3次, 局部坐标最终变化为 10, 0, 10
//transform.DOLocalJump(new Vector3(10, 10, 10), 3, 10);
// 5 秒内, 局部坐标变化到 10,10,10
//transform.DOLocalMove(new Vector3(10, 10, 10), 5);
// 10 秒内 X 局部坐标变换到 5
//transform.DOLocalMoveX(5, 10);
// 10 秒内 Y 局部坐标变化到 5
//transform.DOLocalMoveY(5, 10);
//10 秒内 Z 局部坐标变化到 5
//transform.DOLocalMoveZ(5, 10);
//transform.DOLocalPath();
//5 秒内 局部旋转变化到 10,10, 10
//transform.DOLocalRotate(new Vector3(10, 10, 10), 5);
// 自身朝向 坐标(10,10,10)
//transform.DOLookAt(new Vector3(10, 10, 10), 5);
// 5 秒内 移动到 坐标 (10,10,10)
//transform.DOMove(new Vector3(10, 10, 10), 5);
//10 秒内 X 局部坐标变化到 5
//transform.DOMoveX(5, 10);
//10 秒内 Y 局部坐标变化到 5
//transform.DOMoveY(5, 10);
//10 秒内 Z 局部坐标变化到 5
//transform.DOMoveZ(5, 10);
//transform.DOPath();
//执行该方法停止 变化
//transform.DOPause();
//transform.DOPlay();
//变化结束前调用该方法,物体回到原始位置
//transform.DOPlayBackwards();
//执行 transform.DOPlayBackwards(); 物体回到原始位置
//执行 下面方法则再次变化
//transform.DOPlayForward();
//冲压机,在 5 秒内在原始坐标和下面坐标之间,来回冲压
//transform.DOPunchPosition(new Vector3(10, 10, 10), 5);
//冲压机,在 5 秒内在原始旋转和下面角度之间,来回冲压变化
//transform.DOPunchRotation(new Vector3(50, 50, 50), 5);
//冲压机,在 5 秒内在原始比例和下面比例之间,来回冲压变化
//transform.DOPunchScale(new Vector3(5, 5, 5), 5);
//在变化结束之前,执行该方法,则重新开始变化
//transform.DORestart();
//变化过程中执行该方法,回到原始
//transform.DORewind();
// 10 秒内 旋转角度 到 (50,50,50)
//transform.DORotate(new Vector3(50, 50, 50), 5);
// 10 秒内 比例变化到 (5,5,5)
//transform.DOScale(new Vector3(5, 5, 5), 5);
// 10 秒内 X 比例变化到 5
//transform.DOScaleX(5, 10);
// 10 秒内 Y 比例变化到 5
//transform.DOScaleY(5, 10);
// 10 秒内 Z 比例变化到 5
//transform.DOScaleZ(5, 10);
// 10 秒内 物体 X,Y,Z 坐标在 自身-5 到 自身加 5 之间震动
//transform.DOShakePosition(10, new Vector3(10, 10, 10));
// 10 秒内, 物体 X,Y,Z 旋转角度在 自身-5 到 自身加 5 之间震动
//transform.DOShakeRotation(10, new Vector3(10, 10, 10));
// 10 秒内, 物体 X,Y,Z 比例在 自身-5 到 自身加 5 之间震动
//transform.DOShakeScale(10, new Vector3(10, 10, 10));
//在变化过程中执行该方法,停止、开始、停止、开始
//transform.DOTogglePause();
// 执行该方法,坐标立即变化为 0,5,0, 从 0,5,0 两秒移动到初始位置
//transform.DOMove(new Vector3(0, 5, 0), 2).From();
// 执行该方法,移动到相对于原始位置 6,0,2 的位置
// 如原始位置 3,2,1。 移动后位置为 3+6,2+0,2+2 即 9,2,4
//transform.DOMove(new Vector3(6, 0, 2), 2).SetRelative();
#endregion
#region DOTween回调方法 以 On 开头
CallBack()
// 创建一个 Tweener 对象, 另 number的值在 5 秒内变化到 100
Tween t = DOTween.To(() =& number, x =& number = x,
// DOTween 可以连续调用 N 次方法如下
// 执行变化的过程中可以回调的方法
// 下面是不带参数的回调方法
t.OnStart(OnStartTween).OnKill(OnKill).OnPause(OnPause).OnPlay(OnPlay).OnRewind(OnRewind);
t.OnStepComplete(OnStepComplete).OnUpdate(UpdateTweenEd).OnComplete(OnComplete);
// 带参数的回调方法如下
t.OnUpdate(() =& UpdateTweenED(number)); }
UpdateTweenED(int
num) { Debug.Log("num
OnComplete()
{ Debug.Log("OnComplete");
// 完成变化时回调
{ Debug.Log("OnKill");
// 执行结束后自动杀死,回调一次
{ Debug.Log("OnPlay");
// 开始执行调用一次, 该方法在 OnStart 方法后调用
{ Debug.Log("OnPause");
// 暂停回调
OnRewind()
{ Debug.Log("OnRewind");
//倒回回调
OnStartTween()
{ Debug.Log("StartTween");
// 开始执行最先回调, 该方法在 OnPlay 方法前调用
OnStepComplete()
{ Debug.Log("OnStepComplete");
// 如果循环的,每循环完成调用一次。 不是循环的则完成执行
UpdateTweenEd()
{ Debug.Log(number);
// 变化过程中, 每帧回调该方法
OnWayPointChange()
{ Debug.Log("OnWayPointChange");
// 当路点发生变化时回调,在执行 DOPath 回调
#endregion
#region Set 方法
FunctionSet()
{ Vector3 pos = Vector3.
// 设置了循环类型 LoopType.Yoyo 和缓冲类型 Ease.InOutCirc
Tween tween = DOTween.To(() =& pos, r =& pos = r,
Vector3(5,
1).SetLoops(-1,
LoopType.Yoyo).SetEase(Ease.InOutCirc);
//复制一个 Tween 对象的 id, ease, loops, delay, timeScale, callbacks, etc
到另一个 Tween 对象
// t 复制 tween 的循环类型和缓冲类型
Tween t = DOTween.To(() =& transform.position, r =&
transform.position = r,
Vector3(15,
2).SetAs(tween);
// SetAutoKill 设置自动销毁
// SetDelay 设置延迟
// SetEase 设置缓冲类型
// SetId 设置ID 可以只用 int、string、object等类型的值
// SetLoops 设置循环类型
// SetRecyclable 设置为可回收,可循环使用的
// SetRelative 设置相对变化
// SetSpeedBased
// SetTarget
// 设置 Update 的值 告诉 Tween对象 是否忽视 Unity的 的 timeScale ,即是否受Unity
时间的影响
// SetUpdate(UpdateType.Normal, true) 设置为 true 为忽视
Unity的时间影响
// 设置为 false 为不忽视Unity的时间影响
// SetUpdate
transform.DOMoveX(20,
5).SetAutoKill(true).SetDelay(3).SetEase(Ease.InOutCirc)
.SetId("superTween").SetLoops(
LoopType.Yoyo).SetRecyclable()
.SetRelative().SetSpeedBased().SetTarget(transform).SetUpdate(UpdateType.Normal,
#endregion
#region Sequence 队列
FunctionSequence()
duration =
Sequence s = DOTween.Sequence();
// 添加 一个相对于原始位置 水平方向移动, 时间 3 秒,缓冲类型 为 Ease.InOutQuad
s.Append(transform.DOMoveX(6,
3).SetRelative().SetEase(Ease.InOutQuad));
//插入一个旋转, 设置循环类型为 来去 方式
// and will loop forward and backward twice
s.Insert(0,
transform.DORotate(new
Vector3(0,
duration /
2).SetEase(Ease.InQuad).SetLoops(100,
LoopType.Yoyo));
// Add a color tween that will start at half the duration and last
until the end
s.Insert(duration /
transform.GetComponent().material.DOColor(Color.yellow, duration
// Set the whole Sequence to loop infinitely forward and
s.SetLoops(-1,
LoopType.Yoyo); }
#endregion
#region 设置冷却转圈的 Image
Image dotweenLogo, circleO
FunctionImageCollDown()
{ circleOutline = GetComponent();
(circleOutline ==
// 随机设置 颜色
circleOutline.DOColor(RandomColor(),
1.5f).SetEase(Ease.Linear).Pause();
//设置冷却转圈 附带设置 转一圈完成的回调方法(回调方法直接实现,不用调用其他的方法)
circleOutline.DOFillAmount(0,
1.5f).SetEase(Ease.Linear).SetLoops(-1,
LoopType.Yoyo) .OnStepComplete(() =& {
circleOutline.fillClockwise = !circleOutline.fillC
circleOutline.DOColor(RandomColor(),
1.5f).SetEase(Ease.Linear);
}) .Pause(); dotweenLogo = GetComponent();
(dotweenLogo ==
// 这是Image 的褪色,即 慢慢变为 看不见
dotweenLogo.DOFade(0,
1.5f).SetAutoKill(false).Pause();
RandomColor()
Color(Random.Range(0f,
Random.Range(0f,
Random.Range(0f,
#endregion
#region 设置 Text 的跑马字,一秒显示 N
Text text, relativeText, scrambledT
FunctionText()
{ text = GetComponent();
// Animate the first text...
text.DOText("This
text will replace the existing one",
2).SetEase(Ease.Linear).SetAutoKill(false).Pause();
relativeText = GetComponent();
// Animate the second (relative) text...
relativeText.DOText("
- This text will be added to the existing one",
2).SetRelative().SetEase(Ease.Linear).SetAutoKill(false).Pause();
scrambledText = GetComponent();
// Animate the third (scrambled) text...
scrambledText.DOText("This
text will appear from scrambled chars",
true).SetEase(Ease.Linear).SetAutoKill(false).Pause();
#endregion
#region Slider
FunctionSlider()
{ slider = GetComponent(); slider.DOValue(1,
1.5f).SetEase(Ease.InOutQuad).SetLoops(-1,
LoopType.Yoyo).Pause(); }
#endregion
FunctionDOTween()
{ DOTween.PlayAll();
// 开始所有 Tween 对象
DOTween.RestartAll();
// 所有 Tween对象 从新开始
#endregion
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。DoTween学习笔记(一)
时间: 00:57:27
&&&& 阅读:302
&&&& 评论:
&&&& 收藏:0
标签:DOTween是一个快速,高效,完全统一的类型安全的对象属性动画引擎,免费开源,大量的高级特性.
DoTween兼容Unity4.5以上的版本,支持的平台: Win, Mac, Unity WebPlayer, WebGL, iOS, Android,Windows Phone 8, Windows Store, PS Vita (PSM), PS4,Xbox One平台,
速度和效率: 不仅非常快,而且非常有效:一切都是缓存和重用,避免无用的GC分配。
快捷: 使用扩展方法扩展公共对象用户方便编写代码如下
// Move a transform to position 1,2,3 in 1 second
transform.DOMove(new Vector3(<span style="color: #,<span style="color: #,<span style="color: #), <span style="color: #);
// Scale the Y of a transform to 3 in 1 second
transform.DOScaleY(<span style="color: #, <span style="color: #);
// Pause a transform‘s tween
transform.DOPause();
几乎支持任何动画: 支持属性数字,非数字, 字符串和富文本动画展现
还有很多我就不一一介绍了
简单移动Cube到达目的地:
// Use this for initialization
void Start () {
//向0,4,0的位置移动过去
cube.DOMove(new Vector3(<span style="color: #,<span style="color: #,<span style="color: #), <span style="color: #);
//从0,4,0的位置移动过来
cube.DOMove (new Vector3 (<span style="color: #, <span style="color: #, <span style="color: #), <span style="color: #).From();
//向0,4,0的位置来回移动
cube.DOMove (new Vector3 (<span style="color: #, <span style="color: #, <span style="color: #), <span style="color: #).SetRelative().SetLoops(-<span style="color: #,LoopType.Yoyo);
//另一种写法
DOTween.To(()=& cube.position, x=& cube.position = x, new Vector3(<span style="color: #, <span style="color: #, <span style="color: #), <span style="color: #).SetRelative().SetLoops(-<span style="color: #, LoopType.Yoyo);
移动,旋转,缩放:
//向上移动4个单位
cube.transform.DOBlendableMoveBy (new Vector3 (<span style="color: #, <span style="color: #, <span style="color: #), <span style="color: #);
//自身坐标向上移动4个单位
cube.transform.DOBlendableLocalMoveBy (new Vector3 (<span style="color: #, <span style="color: #, <span style="color: #), <span style="color: #);
cube.transform.DOBlendableRotateBy(new Vector3(<span style="color: #, <span style="color: #0, <span style="color: #), <span style="color: #).SetLoops(-<span style="color: #,LoopType.Yoyo);
//本地坐标系转换30度
cube.transform.DOBlendableLocalRotateBy(new Vector3(<span style="color: #, <span style="color: #0, <span style="color: #), <span style="color: #).SetLoops(-<span style="color: #,LoopType.Yoyo);
//开始值(1,1,1) 5秒内增加到 (3,3,3)
cube.transform.DOBlendableScaleBy(new Vector3(2, 2, 2), 5);
跳跃,冲压机
DOJump(new Vector3(5, 0, 0), 5, 1,5);
假设cube坐标(0,0,0)最终跳跃到(5,0,0)位置,跳跃的中间最高度是5,跳跃1次,5秒完成
DOPunchPosition(new Vector3(10, 10, 10), 5);
在 5 秒内在原始坐标和下面坐标之间,来回冲压
DOPunchRotation(new Vector3(50, 50, 50), 5);
在 5 秒内在原始旋转和下面角度之间,来回冲压变化
DOPunchScale(new Vector3(5, 5, 5), 5);
在 5 秒内在原始比例和下面比例之间,来回冲压变化
控制Itween方法:
DOComplete();&#160;&#160;&#160;
执行该方法,变化立即结束,且完成移动
DOFlip();&#160;&#160;&#160;
在变化过程中执行该方法,则物体慢慢的变回原样,如果变化已经完成,该方法无效
DOGoto(2);
变化过程中执行该方法,则物体变化到 第二秒 时该物体的位置、比例等
停止掉当前的变化
DOPlayBackwards();
播放结束之前,让物体倒序运动到原位
DOPlayForward();
播放结束之前,让物体继续运动到目标位置
DORestart();&#160;&#160;&#160;
在变化结束之前,执行该方法,则重新开始变化
DORewind();
变化过程中执行该方法,回到原始
DOPause();
&&国之画&&&& &&&&chrome插件&&
版权所有 京ICP备号-2
迷上了代码!

我要回帖

更多关于 ios 相机旋转 的文章

 

随机推荐