/**
*Copyright(C) 2015 by #COMPANY#
*All rights reserved.
*FileName: #SCRIPTFULLNAME#
*Author: #Class_Lee#
*Version: #VERSION#
*UnityVersion��#UNITYVERSION#
*Date: #DATE#
*/
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using DG.Tweening;
public class BtnMove : MonoBehaviour
{
private bool isOn = false;
Button btn;
Text txt;
Tweener tweener;
// Use this for initialization
void Start ()
{
btn = transform.parent.Find ("btn").GetComponent<Button> ();
btn.onClick.AddListener (PanelMove);
txt = transform.Find ("Text").GetComponent<Text> ();
}
void PanelMove ()
{
if (!isOn) {
tweener = transform.DOLocalMove (new Vector3 (1500f, 1500f, 1500f), 3f);
transform.DOLocalRotate (new Vector3 (0f, 0f, 180f), 3f);
isOn = true;
} else {
tweener = transform.DOLocalMove (Vector3.zero, 3f);
transform.DOLocalRotate (new Vector3 (0f, 0f, 180f), 3f);
tweener.OnComplete (DisplayTxt);
isOn = false;
}
}
void DisplayTxt ()
{
StartCoroutine ("Dis");
}
IEnumerator Dis ()
{
Tweener aa = txt.DOText ("wowowowoowowowowoowowowowowoowowowoowowowowoowo", 4f);
yield return new WaitForSeconds (1);
txt.DOColor (Color.yellow, 10f);
yield return new WaitForSeconds (6);
txt.text = ("");
}
// Update is called once per frame
void Update ()
{
}
}
Dotween 入门
猜你喜欢
转载自blog.csdn.net/qq_39097425/article/details/81907479
今日推荐
周排行