-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCloudAnime.cs
More file actions
49 lines (31 loc) · 821 Bytes
/
CloudAnime.cs
File metadata and controls
49 lines (31 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class CloudAnime : MonoBehaviour {
public Image imgCloud;
public Image imgStart;
public Image imgEnd;
public float cloudspeed = 3f;
private float sw;
void Start () {
sw = Screen.width;
Debug.Log (sw);
}
// Update is called once per frame
void Update () {
// RectTransform rt = imgCloud.rectTransform;
// imgCloudWidth = rt.rect.width;
Vector3 pos = imgCloud.transform.position;
Vector3 startPos = imgStart.transform.position;
Vector3 endPos = imgEnd.transform.position;
if (pos.x < endPos.x) {
Vector3 setThis = new Vector3 (startPos.x, imgCloud.transform.position.y);
imgCloud.transform.position = setThis;
}
else
{
pos.x -= cloudspeed;
imgCloud.transform.position = pos;
}
}
}