Haig Armen Educational Archive


Exercise 19

by Haig. Average Reading Time: less than a minute.

Improving our drawing app


void draw() {
  if (mousePressed == true) {
    point(mouseX,mouseY);
  }
}

void keyPressed() {
  if (key == 's') {
    save("my_drawing.png");
  }
  if (key == 'b') {
    background(random(255), random(255), random(255));
    draw_top_line();
  }
  if (key == 'c') {
    stroke(random(255), random(255), random(255));
    draw_top_line();
  }
}
void draw_top_line() {
    strokeWeight(7);
    line(0,0, width, 0);
    strokeWeight(2);
}

No comments on ‘Exercise 19’

Leave a Reply