1 using UnityEngine; 2 using System.Collections; 3 using DG.Tweening; 4 5 public class GetStart : MonoBehaviour 6 { 7 8 public Vector3 myValue = new Vector3(0, 0, 0); 9 10 public Transform tr;11 12 bool isIn = false;13 14 // Use this for initialization15 void Start()16 {17 //DOTween.To(() => { return myValue; }, (x) => { myValue = x; }, new Vector3(10, 10, 10), 2);18 19 //transform.DOMove(new Vector3(10, 10, 10), 2).OnComplete(()=>{20 // transform.GetComponent().material.DOColor(Color.green, 1);21 //});22 23 //DOTween.To(() => myValue, x => myValue = x, new Vector3(0, 0, 0), 1);24 25 26 Tweener er = tr.DOLocalMove(new Vector3(0, 0, 0), 0.5f);27 er.SetAutoKill(false);28 er.Pause();29 30 }31 32 // Update is called once per frame33 void Update()34 {35 //tr.position = myValue;36 //tr.GetComponent ().localPosition = myValue;37 38 //Tween t;39 //t.SetAutoKill(false); //播放完不销毁40 //tr.DOPlayForward();//回放,向前播放41 //tr.DOPlayBackwards(); //向后播放42 43 //t.Pause(); //暂停44 //t.Play();//播放45 46 //tr.DOPlay(); //也是播放。来播放对象上的动画,这个只会播放一次47 }48 49 public void btnClick()50 {51 if (!isIn)52 {53 //tr.DOPlay();54 tr.DOPlayForward();55 isIn = true;56 }57 else58 {59 isIn = false;60 //tr.DOLocalMove(new Vector3(552, 0, 0), 0.5f);61 tr.DOPlayBackwards();62 }63 }64 }