|
用到的函数 |
1 |
tweener.SetAutoKill(false) |
2 |
tweener.Pause() |
3 |
transform.DOPlayForward() |
4 |
transform.DOPlayBackwards() |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class DG_1To : MonoBehaviour {
private bool isIn = false;
void Start () {
Tweener tweener = transform.DOMove(new Vector3(10, 10, 10), 30);
tweener.SetAutoKill(false);
tweener.Pause();
}
public void OnClick()
{
if (isIn == false)
{
transform.DOPlayForward();
isIn = true;
}
else
{
transform.DOPlayBackwards();
isIn = false;
}
}
}
|
用到的函数 |
1 |
tweener.SetEase(Ease.InElastic); |
2 |
tweener.SetLoops(2); |
3 |
tweener.OnComplete(OverTwe); |
4 |
transform.DOMoveX(6, 3); |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class DG_2 : MonoBehaviour {
void Start () {
Tweener tweener = transform.DOMoveX(6, 3);
tweener.SetEase(Ease.InElastic);
tweener.SetLoops(2);
tweener.OnComplete(OverTwe);
}
void Update () {
}
void OverTwe()
{
print("HHHH");
}
}
逐字显示文本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class DG_3DOText : MonoBehaviour {
private Text text;
void Start () {
text = this.GetComponent<Text>();
text.DOText("HHHHHHHHHHHHHHHHHHHHHHH", 5);
}
void Update () {
}
}
镜头震动效果
- transform.DOShakePosition(2, 0.5f);
- 具体参数去http://dotween.demigiant.com/documentation.php#editorMethods
可视化添加场景漫游
- 在cinema中添加DOTween Path组件,完成路径设置