Unity实现跑马灯效果的示例代码

2022-05-07 07:19:22
目录
一、效果
二、需要动画插件DOTween
三、脚本
1.每个格子上的脚本文件
2.管理脚本文件

一、效果

Unity实现跑马灯效果的示例代码

二、需要动画插件DOTween

下载地址

三、脚本

1.每个格子上的脚本文件

using>

2.管理脚本文件

using>ightCor = StartCoroutine(RightRoatation()); } private IEnumerator LeftRoatation() { KillAllDOTween(); yield return new WaitForSeconds(0.01f); m_firstImage.GetComponent<MarqbEEVsueeUIItem>().UpdateImageColorA(); yield return new WaitForSeconds(time_interval); for (int i = m_allImage.Length-1; i > -1; i--) { m_allImage[i].GetComponent<MarqueeUIItem>().UpdateImageColorA(); yield return new WaitForSeconds(time_interval); } yield return new WaitForSeconds(time_interval); m_firstImage.GetComponent<MarqueeUIItem>().UpdateImageColorA(); } private IEnumerator RightRoatation() { KillAllDOTween(); yield return new WaitForSeconds(0.01f); m_firstImage.GetComponent<MarqueeUIItem>().UpdateImageColorA(); yield return new WaitForSeconds(time_interval); for (int i = 0; i < m_allImage.Length; i++) { m_allImage[i].GetComponent<MarqueeUIItem>().UpdateImageColorA(); yield return new WaitForSeconds(time_interval); } yield return new WaitForSeconds(time_interval); m_firstImage.GetComponent<MarqueeUIItem>().UpdateImageColorA(); } private void KillAllDOTween() { m_firstImage.GetComponent<MarqueeUIItem>().KillDOTween(); m_firstImage.color = Color.clear; for (int i = 0; i < m_allImage.Length; i++) { m_allImage[i].GetComponent<MarqueeUIItem>().KillDOTween(); m_allImage[i].color = Color.clear; } } }

设置

Unity实现跑马灯效果的示例代码

Unity实现跑马灯效果的示例代码

Unity实现跑马灯效果的示例代码

到此这篇关于Unity实现跑马灯效果的示例代码的文章就介绍到这了,更多相关Unity跑马灯效果内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!