-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimation.java
67 lines (57 loc) · 1.46 KB
/
Animation.java
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import mayflower.*;
public class Animation
{
private int currentFrame;
private int frameRate;
private MayflowerImage[] frames;
public Animation(int frameRate, String[] arr)
{
frames = new MayflowerImage[arr.length];
for (int i = 0; i < frames.length; i ++)
{
frames[i] = new MayflowerImage(arr[i]);
}
currentFrame = frameRate;
currentFrame = 0;
}
public int getFrameRate()
{
return frameRate;
}
public MayflowerImage getNextFrame(){
MayflowerImage nextFrame = frames[currentFrame];
if (currentFrame < frames.length-1)
{
currentFrame++;
}
else
{
currentFrame = 0;
}
return nextFrame;
}
public void scale(int w, int h)
{
for (int i=0;i<frames.length;i++){
frames[i].scale(w, h);
}
}
public void setTransparency(int percent)
{
for (int i=0;i<frames.length;i++){
frames[i].setTransparency(percent);
}
}
public void mirrorHorizontally()
{
for (int i=0;i<frames.length;i++){
frames[i].mirrorHorizontally();
}
}
public void setBounds(int x, int y, int w, int h)
{
for (int i=0;i<frames.length;i++){
frames[i].crop(x, y, w, h);
}
}
}