美文网首页
2018-03-07

2018-03-07

作者: Walk_In_Jar | 来源:发表于2018-03-07 11:51 被阅读0次
    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() + "%";
        }
    }
    

    相关文章

      网友评论

          本文标题:2018-03-07

          本文链接:https://www.haomeiwen.com/subject/lakjfftx.html