123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class UITweener : MonoBehaviour {
- public RectTransform mainWindow = null;
- public LeanTweenType leanTweenType = LeanTweenType.notUsed;
- public float time = .1f;
- public float Delaytime = .1f;
- private bool isOpen = false;
- void Start () {
- }
- void Open()
- {
- mainWindow.transform.position = new Vector3(1, 0, 0);
- LeanTween.move(mainWindow, Vector3.zero, time).setEase(leanTweenType);
- //mainWindow.localScale = Vector3.zero;
- //LeanTween.scale(mainWindow, new Vector3(0.001f, 0.001f, 0.001f), time).setEase(leanTweenType).setDelay(Delaytime);
- CanvasGroup cg = mainWindow.GetComponent<CanvasGroup>();
- cg.alpha = 0;
- LeanTween.alphaCanvas(cg, 1f, time).setDelay(Delaytime);
- }
- void Close()
- {
- LeanTween.scale(mainWindow, Vector3.zero, 2.6f).setDelay(0.5f).setEase(LeanTweenType.easeInBack);
- CanvasGroup cg = mainWindow.GetComponent<CanvasGroup>();
- LeanTween.alphaCanvas(cg, 0f, 1f).setDelay(2.5f);
- }
-
- // Update is called once per frame
- void Update () {
- if (Input.GetKeyUp(KeyCode.Space))
- {
- Open();
- }
- }
- }
|