forked from Supercolony/matthanns
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.pde
executable file
·114 lines (97 loc) · 1.8 KB
/
build.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import processing.pdf.*;
boolean record = false;
HShape d, e;
HColorPool colors;
HDrawablePool pool, pool2, pool3;
void setup(){
size(1000,1000);
H.init(this).background(#fbe1c8);
smooth();
colors = new HColorPool(#37bccd,#2c2c2e,#1c7686,#e3e4d6);
pool2 = new HDrawablePool(15);
pool2.autoAddToStage()
.add(new HShape("vectors-1.svg"))
.layout(
new HGridLayout()
.startX(0)
.startY(500)
.spacing(5,5)
.cols(1)
)
.onCreate(
new HCallback() {
public void run(Object obj) {
HShape d = (HShape) obj;
d
.enableStyle(false)
//.stroke(#ffffff)
//.strokeWeight(2)
.noStroke()
//.fill(#000000)
.anchorAt(H.CENTER)
.size((int)random(700,800))
.rotate(180)
;
d.randomColors(colors.fillOnly());
}
}
)
.requestAll()
;
pool = new HDrawablePool(15);
pool.autoAddToStage()
.add(new HShape("vectors-1.svg"))
.layout(
new HGridLayout()
.startX(500)
.startY(500)
.spacing(5,5)
.cols(1)
)
.onCreate(
new HCallback() {
public void run(Object obj) {
HShape d = (HShape) obj;
d
.enableStyle(false)
//.stroke(#ffffff)
//.strokeWeight(2)
.noStroke()
//.fill(#000000)
.anchorAt(H.CENTER)
.size((int)random(700,1500))
//.rotate((int)random(180))
;
d.randomColors(colors.fillOnly());
}
}
)
.requestAll()
;
}
void draw() {
//saveFrame();
H.drawStage();
PGraphics tmp = null;
if (record) {
tmp = beginRecord(PDF, "render-######.pdf");
}
if (tmp == null) {
H.drawStage();
} else {
PGraphics g = tmp;
boolean uses3D = false;
float alpha = 1;
H.stage().paintAll(g, uses3D, alpha);
}
if (record) {
endRecord();
record = false;
}
}
void keyPressed() {
if (key == 's') {
record = true;
draw();
}
}