最近在学Unity3D,看到一个博主做了一个圆环, 博客链接如下:http://blog.csdn.net/tab_space/article/details/51775163。 自动动手修改了点代码,并多画了两个进度条,比较拙劣,先分享在这里。
主要思路
用一个UI对象Image,导入图片资源,然后设置以下属性.在脚本中,每帧刷新改变Fill Amont属性的值,可以看到进度条变化.
{
"
ImageType" :
"Filled",
"
FillMethod" :
"Radial 360",
"
FillOrigin" :
"Top",
"
Clockwise" :
False
}
Paste_Image.png
void Update () {
if (currentAmout < targetProcess) {
Debug.Log(
"currentAmount:" + currentAmout.ToString());
currentAmout += speed;
if(currentAmout > targetProcess)
currentAmout = targetProcess;
indicator.GetComponent<Text>().text = ((
int)currentAmout).ToString() +
"%";
process.GetComponent<Image>().fillAmount = currentAmout/
100.0f;
}
}
效果
Paste_Image.png
Demo,包含Sketch的图片资源
相关资源:Java实现圆圈旋转效果,等待、加载、刷新、旋转进度条