-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.pde
52 lines (41 loc) · 947 Bytes
/
Block.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
class Block
{
PVector position = new PVector(0,0);
float scale = 1;
float z = 0;
float w = 1;
float h = 1;
float halfW;
float halfH;
float fillColor;
float counter = 0;
float counterInc = 0;
Block(PVector position, float w, float h, float z)
{
this.position = position;
this.w = w;
this.h = h;
this.z = z;
halfW = w/2;
halfH = h/2;
fillColor = (float)Math.random() * 360;
scale = (float)Math.pow(2, -z/zoom);
//scale = (float)2 * -z + 10;
counter = (float)Math.random() * 10;
counterInc = (float)(Math.random() * .06) - .03;
}
void draw()
{
counter+= counterInc;
colorMode(HSB);
stroke(360, 0, 255);
//noFill();
fill(fillColor, 255, 255);
translate(position.x,position.y);
float theta = counter;
rotate(theta);
rectMode(CENTER);
rect(0, 0, w * scale, h * scale);
resetMatrix();
}
}