DOTween初步研究

1.在一定时间内移动目标Transform到目标地点

redCube.DOMove(new Vector3(0, 4, 0), 2);

2.在一定时间内从目标地点移动到当前位置

greenCube.DOMove(new Vector3(0,4,0), 2).From();

3.在一定时间内移动目标向量

blueCube.DOMove(new Vector3(0,4,0), 2).SetRelative();

4.在一定时间内让目标材质(spriterenderer/Image)变色

purpleCube.GetComponent<Renderer>().material.DOColor(Color.yellow, 2)

5以一定循环次数以及方式设置循环

purpleCube.GetComponent<Renderer>().material.DOColor(Color.yellow, 2).SetLoops(3, LoopType.Yoyo);

6设置自动销毁(可以防止保存的Tween被自动销毁)

tween = transform.DOMove(target.position, 2).SetAutoKill(false);

7重新设置Tween的终值

Tween tween.ChangeEndValue(target.position, true)

8重新启动已被关闭的Tween

tween.ChangeEndValue(target.position, true).Restart();

9在一定时间内让目标材质的目标Color变量变色

mat.DOColor(new Color(0, 0, 0, 0), "_EmissionColor", 1)

10暂停Tween

tween.Pause();

11开关Tween

colorTween.TogglePause();

12令目标在一定时间内以一定的平滑移动方式沿着路径移动

target.DOPath(waypoints, 4, pathType);

13令目标物体在移动时朝向目标

target.DOPath(waypoints, 4, pathType).SetOptions(true).SetLookAt(0.001f);

14令目标路径封闭

target.DOPath(waypoints, 4, pathType).SetOptions(true);

15设置Tween的插值方式

tween.SetEase(Ease.Linear);

16设置Tween以增量的方式插值,即将结束值设置成结束值+初始值

s.Append(cube.DOMoveX(6, duration).SetRelative();

17声明一个队列

Sequence s = DOTween.Sequence();

18为队列增加一个Tween到底部

s.Append(cube.DOMoveX(6, duration).SetRelative().SetEase(Ease.InOutQuad));

19为队列增加一个Tween到目标位置(时间)

s.Insert(0, cube.DORotate(new Vector3(0, 45, 0), duration / 2).SetEase(Ease.InQuad).SetLoops(2, LoopType.Yoyo));

20开始重启循环队列

s.SetLoops(-1, LoopType.Yoyo);
s.Play();
s.Restart();

21淡出

dotweenLogo.DOFade(0, 1.5f);

22设置UGUI填充插值

circleOutline.DOFillAmount(0, 1.5f)

23设置阶段完成回调(如果是Loop的话每段都会触发回调)

circleOutline.DOFillAmount(0, 1.5f).OnStepComplete(()=> {
				circleOutline.fillClockwise = !circleOutline.fillClockwise;
				circleOutline.DOColor(RandomColor(), 1.5f).SetEase(Ease.Linear);
			});

24设置文字替换

text.DOText("This text will replace the existing one", 2);

25设置文字增加

relativeText.DOText(" - This text will be added to the existing one", 2).SetRelative();

26以乱码形式出现文字

scrambledText.DOText("This text will appear from scrambled chars", 2, true, ScrambleMode.All);

27设置值

slider.DOValue(1, 1.5f);

28开始所有Tween

DOTween.PlayAll();

29重启所有Tween

DOTween.RestartAll();
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值