使用RawImage更改UV实现循环播放画面

时间:2021-09-21 16:37:23   收藏:0   阅读:21

需要实现的是波形图

技术分享图片

 

需要先更改波形图片设置 Wrap Mode为Repeat模式

 

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class offectuv : MonoBehaviour {


    float x ;
    public float speed=0.01f;
    public RawImage myRaw;
    void Start ()
    {
        x = myRaw.uvRect.x;
    }
    // Update is called once per frame
    void Update()
    {
        if (x <= -1f)
        {
            x = 0;
            x = x - speed;
        }
        else
        {
            x = x - speed;
        }
        myRaw.uvRect = new Rect(x, 0, 1, 1);
    }
}

 

原文:https://www.cnblogs.com/chenxiya/p/15308162.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!