Week 2 HW

A sketch to draw shapes overlapping of variable opacity.

  • Show Sketch
/** @peep sketchcode */
 
void setup() {
  size(400, 400); //size of drawing space
  background(204);
  frameRate(2); //slow the framerate down to see clear shapes
}
 
void draw() {
 
  pushStyle();
  translate(random(width)-65, random(height)-65); //move each shape to a new location
  fill(255, random(150)); //fill each shape with a random opacity of white
  strokeWeight(random(4)); //randomise the thickness of the black outlines
  stroke(0,random(255)); //make the boarder lines a random opacity
  beginShape(TRIANGLE_FAN); //define the shape style to make from the points, and start the shape
  vertex(random(130), random(130));
  vertex(random(130), random(130));
  vertex(random(130), random(130));
  vertex(random(130), random(130));
  vertex(random(130), random(130));
  vertex(random(130), random(130));
  endShape(); // close the shape
 
  popStyle();
}