Skip to content
Snippets Groups Projects
LoadingCircle.cs 818 B
Newer Older
  • Learn to ignore specific revisions
  • using UnityEngine;
    using static UIconfig;
    
    public class LoadingCircle : MonoBehaviour
    {
        private RectTransform rectComponent;
        public float rotateSpeed = -200f;
    
    MaZiFAU's avatar
    MaZiFAU committed
        private float width = 100;
        private float height = 100;
    
        public float scale;
    
    MaZiFAU's avatar
    MaZiFAU committed
    
    
    
        private void Start()
        {
            rectComponent = GetComponent<RectTransform>();
    
    MaZiFAU's avatar
    MaZiFAU committed
    
    
        }
    
        private void Update()
        {
            rectComponent.Rotate(0f, 0f, rotateSpeed * Time.deltaTime);
            if (scale != 0)
            {
                width = screWidth / scale;
                height = screHeight / scale;
                if (width < height)
                {
                    width = height;
                }
                else
                {
                    height = width;
                }
                rectComponent.sizeDelta = new Vector2(width, height);
            }
    
    
    MaZiFAU's avatar
    MaZiFAU committed