另一个进度条,流畅
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class CircularProgress : MonoBehaviour
{
public Image image;
public float t = 10;
public Text text;
private float value = 0;
private float nowProcess = 0;
// Use this for initialization
void Start()
{
DOTween.To(() => value, x => value = x, 1, t); //在这里用async.process代替value
}
// Update is called once per frame
void Update()
{
if (nowProcess < value)
{
DOTween.To(() => nowProcess, x => nowProcess = x, value, 0.01f);
}
image.fillAmount = nowProcess;
text.text = ((int)(nowProcess * 100)).ToString() + "%";
}
}
网友评论