-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackgroundAnimation.pde
More file actions
62 lines (57 loc) · 1.35 KB
/
BackgroundAnimation.pde
File metadata and controls
62 lines (57 loc) · 1.35 KB
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
class BackgroundAnimation
{
int frameNumberAll;
String nameAll;
int counter;
BackgroundAnimation(int frameNumber, String name)
{
frameNumberAll = frameNumber;
nameAll = name;
counter = 0;
}
PImage[] imageMatrix = new PImage[20];
void Initialize(int sizeX, int sizeY)
{
for (int i = 0; i < frameNumberAll; i++)
{
PImage temp;
temp = loadImage(nameAll + "" + i + ".png");
temp.resize(sizeX,sizeY);
imageMatrix[i] = temp;
}
}
void DisplayAnimation(int posX, int posY,int fps)
{
//println(counter);
if (counter == 0) {image(imageMatrix[counter],posX,posY);}
else{image(imageMatrix[counter - 1],posX,posY);}
if ((float)frameCount % (float)fps == 0)
{
if (counter < frameNumberAll)
{
counter++;
//return true;
}
else
{
counter = 0;
//return false;
}
}
}
void DisplayStatic(int posX, int posY)
{
image(imageMatrix[17],posX,posY);
}
boolean Running()
{
if (counter!= 0)
{
return true;
}
else
{
return false;
}
}
}