generative art - university of waterloocs106/winter... · generative art generative art refers to...
TRANSCRIPT
Generative Art
Slides by Professor Dan Vogel.
Generative Art 1
What is printed to the console on the 10th frame?
Generative Art 2
class Agent {int x;
Agent() {x = 0;
}
void update() {x = x + 1;
}}
Agent a = new Agent();
void draw() {a.update();println(a.x);
}
A. 0
B. 1
C. 9
D. 10
E. 11
Jackson Pollock
Generative Art 3
Generative Art 4
Generative Art
Generative art refers to art that in whole or in part has been
created with the use of an autonomous system. An
autonomous system in this context is generally one that is non-
human and can independently determine features of an
artwork that would otherwise require decisions made directly by
the artist.
https://en.wikipedia.org/wiki/Generative_art
Generative Art 5
Generative Art 6
How To Draw With Code: Casey Reashttps://youtu.be/_8DMEHxOLQE
Generative Rules
1. start at random position with
random N, S, E, or W direction
2. each frame, decide if the line
should turn 90° clockwise
3. draw a line of random length in
current direction
4. if the line leaves the canvas, kill
it and start a new one
Generative Art 7
1
2
3 4 5 6
7
8
9 10 11
1213
14
15
die
bornborn
Example of Generated Lines
Generative Art 8
frame
numbers
line left
canvas
new line is
“born” here
heading E
line is “born” here
heading N
Lines are Drawn by an “Agent”
Generative Art 9
class Agent {float x;float y;// 0 is N, 1 is E, 2 is S, 3 is Wint direction;boolean dead;
Agent() {...
}
void update() {...
}}
way to keep
track of direction
Lines are Drawn by an “Agent”
Generative Art 10
Agent a;
void setup() {...
// create agenta = new Agent();
}
void draw() {// update the agenta.update();
...}
Generative Art 11
1. start at random position with
random N, S, E, or W direction
Agent() {x = random(width);y = random(height);direction = int(random(0, 4));dead = false;
}
0, 1, 2, or 3
probability of
changing
direction
Generative Art 12
2. each frame, decide if the line
should turn 90° clockwise
void update() {...
// decide if it changes direction if (random(100) < probTurn) {
direction = (direction + 1) % 4; }
...modulo 4 wraps
direction back to
0
Generative Art 13
3. draw a line of random length in
current direction
void update() { // save current positionint px = x;int py = y;
float step = random(1, maxStep);// step in the current directionif (direction == 0) {y -= step;
} else if (direction == 1) {x += step;
} else if (direction == 2) {y += step;
} else if (direction == 3) {x -= step;
}line(px, py, x, y);
change x or y
depending on
current direction
Generative Art 14
4. if the line leaves the canvas, kill it …
void update() {...// kill if it leaves the canvasif (x < 0 || x > width || y < 0 || y > height) {
dead = true;}
… and start a new one
void draw() {...// create a new agent if this one diedif (a.dead) {
a = new Agent(); }
generative1
Generative Art 15
start at random position with
random N, S, E, or W direction
each frame, decide if the line
should turn 90° clockwise
draw a line of random length in
current direction
if the line leaves the canvas,
kill it and start a new one
More Generative Art
Generative Art 16
Bohnacker, H., Gross, B., & Laub, J.
(2012). Generative Design: Visualize,
Program, and Create with Processing. http://www.generative-gestaltung.de/code
Pearson, M. (2011). Generative Art (1
edition). Shelter Island, NY : London:
Manning Publications.https://www.manning.com/books/generative-art