作用:通过变量Vector改变
DOTween.To(() => 啥, x => 啥 = x, 目标值,变化时间秒);
DOTween.To(() => 啥, x => 啥 = x, Vector3(10,10,10), 2);
DOTween.To(() => , x => = x, Vector3(10,10,10), 2);
using UnityEngine;
using System.Collections;
using DG.Tweening;//DOTween类
public class GetStart : MonoBehaviour {
public Vector3 myValue = new Vector3(0,0,0);//位置
// Use this for initialization
void Start () {
//对变量做一个动画 (通过插值的方式去修改一个值的变化)
//(原来值(返回x),(接收x)赋值,目标值,变化时间秒)
DOTween.To(() => myValue2, x => myValue2 = x, 10, 2);
}
// Update is called once per frame
void Update () {
}
}
using UnityEngine;
using System.Collections;
using DG.Tweening;
public class GetStart : MonoBehaviour {
public Vector3 myValue = new Vector3(0,0,0);
public Transform cubeTransform;
public RectTransform taskPanelTransform;
public float myValue2 = 0;
// Use this for initialization
void Start () {
//对变量做一个动画 (通过插值的方式去修改一个值的变化)
//(,秒)
DOTween.To(() => myValue2, x => myValue2 = x, 10, 2);
}
// Update is called once per frame
void Update () {
//cubeTransform.position = myValue;
//taskPanelTransform.position = myValue;
taskPanelTransform.localPosition = myValue;
}
}