Week 8

by Yulong Guo
  • Show Code
/** @peep sketch */
/* @pjs preload="/uploads/16076/images.jpg"; */
PImage colourful;
void setup() {
  size(400, 400);
  background(random(255));
  smooth();
  colourful = loadImage("/uploads/16076/images.jpg");
}
void draw() {
 
if (frameCount % 12 == 0) {
  fill(255);
  strokeWeight(random(5, 10));
  rect(0, 0, width, height);
}
  int x = int(random(colourful.width));
  int y = int(random(colourful.height));
  color c = colourful.get(x, y);
  stroke(c, 100);
  float x1 = random(0, width);
  float x2 = x1 + random(-width, width);
  float y1 = random(0, height);
  float y2 = y1 + random(-height, height);
  line(x1, y1, x2, y2);
}

Comments

Nobody has said anything yet.