Unity-DOTween

2019-05-30 18:28:06 浏览数 (2)

The shortcuts way
代码语言:javascript复制
transform.DOMoveX(2, 1).OnComplete(MoveComplete);

transform.DOMove(new Vector3(0, 100f, 0f), 2f, true);

第二种重载将transfrom移动到目标位置 动画结束将执行MoveComplete

设置延迟播放

代码语言:javascript复制
Tween tween = transform.DOMove(new Vector3(0, 100f, 0f), 2f, true);
        tween.SetDelay(2f);

设置循环播放

代码语言:javascript复制
Tween tween = transform.DOLocalMove(new Vector3(0, 100f, 0f), 2f, true);
        tween.SetLoops(2);

暂停播放

代码语言:javascript复制
tween.Pause();

在播放未结束时反向播

代码语言:javascript复制
tween.PlayBackwards();

Each of these shortcuts also has a FROM alternate version except where indicated. Just chain a [From](javascript:void(0)) to a Tweener to make the tween behave as a FROM tween instead of a TO tween.

0 人点赞