-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.pde
66 lines (54 loc) · 1.57 KB
/
Node.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
55
56
57
58
59
60
61
62
63
64
65
66
class Node {
public boolean isVisible;
private int seed;
public int rare;
public PVector position;
public PShape model;
public color stroke;
public color fill;
public float size;
public float rotation;
public Node(int seed, int index/*, String filename*/) {
this.isVisible = true;
randomSeed(seed / 100 + index * 123291);
this.position = new PVector(random(3000), random(3000), random(3000));
//this.model = loadShape(filename);
randomSeed(seed);
this.rare = int(random(1, 20));
if (rare <= 3) {
this.stroke = color(#FFFFFF);
this.fill = color(#505050);
} else if (rare >= 15) {
this.fill = color(0, 0, 0, 0);
this.stroke = color(seed % 1000, seed % 1000 / index, seed % 100 * index);
} else {
this.stroke = color(seed % 1000, seed % 1000 / index, seed % 100 * index);
this.fill = color(seed % 100 * index, seed % 1000 / index, seed % 1000);
}
randomSeed(seed + index);
this.size = random(20, 100);
if (rare <= 3) {
this.size = 300;
}
this.rotation = 0;
}
public void display() {
if (this.isVisible) {
pushMatrix();
translate(this.position.x, this.position.y, this.position.z);
rotateY(radians(rotation));
stroke(this.stroke);
fill(this.fill);
box(this.size);
//shape(this.model);
popMatrix();
if (rare > 5 && rare < 15) {
rotation += random(1, 5);
} else if (rare >= 15) {
rotation += random(15, 20);
} else if (rare == 1) {
rotation -= random(3, 7);
}
}
}
}