-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProceduralAnimatedGridTile.pde
54 lines (50 loc) · 1.63 KB
/
ProceduralAnimatedGridTile.pde
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
//***************************************************************
// kewl computer graphics!
//***************************************************************
class ProceduralAnimatedGridTile extends AnimatedGridTile
{
int tileColor = 0;
//***************************************************************
//origin construtor
//***************************************************************
public ProceduralAnimatedGridTile(int x, int y)
{
super(x,y);
}
//***************************************************************
// XML constructor
//***************************************************************
public ProceduralAnimatedGridTile(XML xml)
{
super(xml);
}
//***************************************************************
// actually draw this tile
//***************************************************************
public void draw()
{
dg.pushStyle();
//fill me in
dg.fill(tileColor);
dg.rect(0,0,40,40);
dg.popStyle();
}
//***************************************************************
// update tick
//***************************************************************
public void update(float dt)
{
//fill me in
tileColor = color(255*(1+sin(millis()/1000.f))/2,
255*(1+sin(20+millis()/900.f))/2,
255*(1+sin(3+millis()/222.f))/2);
}
//***************************************************************
// load with XML
//***************************************************************
void loadWithXML(XML xml)
{
super.loadWithXML(xml);
println("XML: Initializing " + this.getClass().getName());
}
}