vertex()
How to draw a polygon?
task 2: A visual system creating infinite shape-combinations
the random triangle-fan
This simple example reveals the incredible benefit of working with and thinking about generative design. Please take a look at the following sentence: The computer is drawing shapes. What is particular about that? Well, it is the fact, that it is the computer, that is drawing, not you! I gave it a pseudo-creative freedom to make own decisions about the positions of the vertex-points on the canvas. The behaviour of how the computer is making those decisions is defined through random(width/8, width/8*7)
.
// This is a sketch template for the p5diary
color black = #222222;
color white = #eeeeee;
color red = #E14C45;
void setup(){
size(300,300);
fill(red);
}
void draw(){
background(white);
fill(red);
beginShape(TRIANGLE_FAN);
for (int i = 0; i < 5; i++) {
vertex(random(width/8, width/8*7), random(height/8, height/8*7));
}
endShape();
fill(white);
beginShape(TRIANGLE_FAN);
for (int i = 0; i < 5; i++) {
vertex(random(width/8, width/8*7), random(height/8, height/8*7));
}
endShape();
gif(40,1);
}