using System.Collections; using System.Collections.Generic; using UnityEngine; using YKMoon; using YKMoon.Tween; using UnityEngine.UI; namespace YKMoon.Common.Tests { public class TweenTest : MonoBehaviour { public Image m_Target; public Vector2 pos1; public Vector2 pos2; public float duration; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void OnClick1() { MoveTo(pos1); } public void OnClick2() { MoveTo(pos2); } //private YKTween mPosTween; private void MoveTo(Vector2 targetPos) { //if(mPosTween != null) { // YKTweenManager.Instance.Kill(mPosTween); //} //mPosTween = YKTweenManager.Instance.StartTween(this.m_Target.rectTransform.anchoredPosition, targetPos, duration, this.SetPos, ignoreTimeScale: true); } private void SetPos(Vector2 pos) { if(this.m_Target == null) { return; } this.m_Target.rectTransform.anchoredPosition = pos; } } }