Skip to content

Commit 1b6513b

Browse files
committed
动画播放与倒放
1 parent d12dc33 commit 1b6513b

File tree

5 files changed

+33
-24
lines changed

5 files changed

+33
-24
lines changed

DoTweenTraining/DoTweenProject/Assets/MyButton.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.
File renamed without changes.

DoTweenTraining/DoTweenProject/Assets/GetStart.cs.meta renamed to DoTweenTraining/DoTweenProject/Assets/Scripts/GetStart.cs.meta

File renamed without changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using DG.Tweening;
4+
using UnityEngine;
5+
6+
public class MyButton : MonoBehaviour
7+
{
8+
9+
public RectTransform PanelRectTransform;
10+
private bool isIn = false;
11+
private Tweener tweener;
12+
13+
// Use this for initialization
14+
void Start () {
15+
tweener = PanelRectTransform.DOLocalMove(new Vector3(0, 0, 0), 0.35f);
16+
tweener.SetAutoKill(false);
17+
tweener.Pause();
18+
}
19+
20+
public void OnClick()
21+
{
22+
if (isIn == false)
23+
{
24+
tweener.PlayForward();
25+
isIn = true;
26+
}
27+
else
28+
{
29+
tweener.PlayBackwards();
30+
isIn = false;
31+
}
32+
}
33+
}

DoTweenTraining/DoTweenProject/Assets/MyButton.cs.meta renamed to DoTweenTraining/DoTweenProject/Assets/Scripts/MyButton.cs.meta

File renamed without changes.

0 commit comments

Comments
 (0)