private RawImage rimag;
private float offsetX;
private float offsetY; //增量
rimage.uvRect = new Rect();
offsetY = 1/0.4f
private RawImage rimag;
private float offsetX;
private float offsetY; //增量
rimage.uvRect = new Rect();
offsetY = 1/0.4f
public class RawImageAni : MonoBehaviour {
private RawImage _rawImage;
private float _offsetX;
private float _offsetY;
// Use this for initialization
void Start () {
_rawImage = GetComponent<RawImage>();
_offsetX = 1 / 4.0f;
_offsetY = 1 / 2.0f;
StartCoroutine(Ani());
}
private IEnumerator Ani()
{
float x = 0;
float y = 0;
while (true) {
y += _offsetY;
while (true) {
x += _offsetX;
_rawImage.uvRect = new Rect(x, y, _rawImage.uvRect.height,_rawImage.uvRect.width);
yield return new WaitForSeconds(0.3f);
}
}
}
// Update is called once per frame
void Update () {
}
}