2018-03-07

2018-03-07  本文已影响0人  Walk_In_Jar
1.gif

另一个进度条,流畅

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() + "%";
    }
}
上一篇 下一篇

猜你喜欢

热点阅读