zoukankan      html  css  js  c++  java
  • unity图形圆形展开

    脚本如下:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class CircleExpandImage : MonoBehaviour {
        public float timeSeconds = 5f;
        public float timeInterval = 0.05f;
    
        private Image image;
        private float duration;
    
        void Start()
        {
            gameObject.SetActive(false);
            image = GetComponent<Image>();
            image.type = Image.Type.Filled;
            image.fillAmount = 0f;
            image.fillOrigin = (int)Image.Origin90.TopRight;
            duration = 0;
        }
    
        public void begin()
        {
            gameObject.SetActive(true);
            StartCoroutine(DrawCircleImage());
        }
    
        IEnumerator DrawCircleImage()
        {
            Debug.Log(System.DateTime.Now);
            yield return new WaitForSeconds(timeInterval);
            while (duration < 1f)
            {
                duration += 1f / ((timeSeconds - 0.1f) / timeInterval) * 2;
                image.fillAmount = duration;
                yield return new WaitForSeconds(timeInterval);
            }
            Debug.Log(System.DateTime.Now);
        }
    }

    挂到image上,调用begin方法即可。

  • 相关阅读:
    hdoj:2075
    hdoj:2072
    hdoj:2071
    hdoj:2070
    hdoj:2069
    test001
    hdoj:2067
    hdoj:2061
    hdoj:2058
    hdoj:2057
  • 原文地址:https://www.cnblogs.com/lurenjiashuo/p/unity-circle-image.html
Copyright © 2011-2022 走看看