Skip to content

Commit 7055a8f

Browse files
author
Benedikt Gross
committed
initial commit
1 parent 4f67120 commit 7055a8f

File tree

868 files changed

+82789
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

868 files changed

+82789
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

01_P/P_1_0_01/P_1_0_01.pde

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// P_1_0_01.pde
2+
//
3+
// Generative Gestaltung, ISBN: 978-3-87439-759-9
4+
// First Edition, Hermann Schmidt, Mainz, 2009
5+
// Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
6+
// Copyright 2009 Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
7+
//
8+
// http://www.generative-gestaltung.de
9+
//
10+
// Licensed under the Apache License, Version 2.0 (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
19+
/**
20+
* changing colors and size by moving the mouse
21+
*
22+
* MOUSE
23+
* position x : size
24+
* position y : color
25+
*
26+
* KEYS
27+
* s : save png
28+
* p : save pdf
29+
*/
30+
31+
import processing.pdf.*;
32+
import java.util.Calendar;
33+
34+
boolean savePDF = false;
35+
36+
37+
void setup() {
38+
size(720, 720);
39+
noCursor();
40+
}
41+
42+
43+
void draw() {
44+
// this line will start pdf export, if the variable savePDF was set to true
45+
if (savePDF) beginRecord(PDF, timestamp()+".pdf");
46+
47+
colorMode(HSB, 360, 100, 100);
48+
rectMode(CENTER);
49+
noStroke();
50+
background(mouseY/2, 100, 100);
51+
52+
fill(360-mouseY/2, 100, 100);
53+
rect(360, 360, mouseX+1, mouseX+1);
54+
55+
// end of pdf recording
56+
if (savePDF) {
57+
savePDF = false;
58+
endRecord();
59+
}
60+
}
61+
62+
63+
void keyPressed() {
64+
if (key=='s' || key=='S') saveFrame(timestamp()+"_##.png");
65+
if (key=='p' || key=='P') savePDF = true;
66+
}
67+
68+
69+
String timestamp() {
70+
Calendar now = Calendar.getInstance();
71+
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
72+
}
73+
74+
75+

01_P/P_1_0_01/P_1_0_01.png

5.74 KB
Loading

01_P/P_1_1_1_01/P_1_1_1_01.pde

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// P_1_1_1_01.pde
2+
//
3+
// Generative Gestaltung, ISBN: 978-3-87439-759-9
4+
// First Edition, Hermann Schmidt, Mainz, 2009
5+
// Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
6+
// Copyright 2009 Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
7+
//
8+
// http://www.generative-gestaltung.de
9+
//
10+
// Licensed under the Apache License, Version 2.0 (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
19+
/**
20+
* draw the color spectrum by moving the mouse
21+
*
22+
* MOUSE
23+
* position x/y : resolution
24+
*
25+
* KEYS
26+
* s : save png
27+
* p : save pdf
28+
*/
29+
30+
import processing.pdf.*;
31+
import java.util.Calendar;
32+
33+
boolean savePDF = false;
34+
35+
int stepX;
36+
int stepY;
37+
38+
void setup(){
39+
size(800, 400);
40+
background(0);
41+
}
42+
43+
void draw(){
44+
if (savePDF) beginRecord(PDF, timestamp()+".pdf");
45+
46+
noStroke();
47+
colorMode(HSB, width, height, 100);
48+
49+
stepX = mouseX+2;
50+
stepY = mouseY+2;
51+
for (int gridY=0; gridY<height; gridY+=stepY){
52+
for (int gridX=0; gridX<width; gridX+=stepX){
53+
fill(gridX, height-gridY, 100);
54+
rect(gridX, gridY, stepX, stepY);
55+
}
56+
}
57+
58+
if (savePDF) {
59+
savePDF = false;
60+
endRecord();
61+
}
62+
}
63+
64+
void keyPressed() {
65+
if (key=='s' || key=='S') saveFrame(timestamp()+"_##.png");
66+
if (key=='p' || key=='P') savePDF = true;
67+
}
68+
69+
// timestamp
70+
String timestamp() {
71+
Calendar now = Calendar.getInstance();
72+
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
73+
}
74+
75+

01_P/P_1_1_1_01/P_1_1_1_01.png

5.76 KB
Loading

01_P/P_1_1_2_01/P_1_1_2_01.pde

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// P_1_1_2_01.pde
2+
//
3+
// Generative Gestaltung, ISBN: 978-3-87439-759-9
4+
// First Edition, Hermann Schmidt, Mainz, 2009
5+
// Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
6+
// Copyright 2009 Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
7+
//
8+
// http://www.generative-gestaltung.de
9+
//
10+
// Licensed under the Apache License, Version 2.0 (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
19+
/**
20+
* changing the color circle by moving the mouse.
21+
*
22+
* MOUSE
23+
* position x : saturation
24+
* position y : brighness
25+
*
26+
* KEYS
27+
* 1-5 : number of segments
28+
* s : save png
29+
* p : save pdf
30+
*/
31+
32+
import processing.pdf.*;
33+
import java.util.Calendar;
34+
35+
boolean savePDF = false;
36+
37+
int segmentCount = 360;
38+
int radius = 300;
39+
40+
41+
void setup(){
42+
size(800, 800);
43+
}
44+
45+
void draw(){
46+
if (savePDF) beginRecord(PDF, timestamp()+".pdf");
47+
48+
noStroke();
49+
colorMode(HSB, 360, width, height);
50+
background(360);
51+
52+
float angleStep = 360/segmentCount;
53+
54+
beginShape(TRIANGLE_FAN);
55+
vertex(width/2, height/2);
56+
for (float angle=0; angle<=360; angle+=angleStep){
57+
float vx = width/2 + cos(radians(angle))*radius;
58+
float vy = height/2 + sin(radians(angle))*radius;
59+
vertex(vx, vy);
60+
fill(angle, mouseX, mouseY);
61+
}
62+
endShape();
63+
64+
if (savePDF) {
65+
savePDF = false;
66+
endRecord();
67+
}
68+
}
69+
70+
void keyReleased(){
71+
if (key=='s' || key=='S') saveFrame(timestamp()+"_##.png");
72+
if (key=='p' || key=='P') savePDF = true;
73+
74+
switch(key){
75+
case '1':
76+
segmentCount = 360;
77+
break;
78+
case '2':
79+
segmentCount = 45;
80+
break;
81+
case '3':
82+
segmentCount = 24;
83+
break;
84+
case '4':
85+
segmentCount = 12;
86+
break;
87+
case '5':
88+
segmentCount = 6;
89+
break;
90+
}
91+
}
92+
93+
// timestamp
94+
String timestamp() {
95+
Calendar now = Calendar.getInstance();
96+
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
97+
}
98+
99+
100+
101+
102+
103+
104+
105+

01_P/P_1_1_2_01/P_1_1_2_01.png

75.9 KB
Loading

0 commit comments

Comments
 (0)