32 lines
706 B
C#
32 lines
706 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AnimationUI : MonoBehaviour
|
|
{
|
|
public AnimationCurve curve=new AnimationCurve(new Keyframe(0,0),new Keyframe(1,1));
|
|
private float anamationTime = 2f;
|
|
private GameObject panel;
|
|
|
|
IEnumerator ShowPanel()
|
|
{
|
|
float time = 0f;
|
|
while (time <= anamationTime)
|
|
{
|
|
panel.transform.localScale = Vector3.one * curve.Evaluate(time );
|
|
time += Time.deltaTime*anamationTime;
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
|
|
private void OnEnable()
|
|
{
|
|
panel = gameObject;
|
|
StartCoroutine(ShowPanel());
|
|
}
|
|
|
|
|
|
}
|