> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.tO56eKcaMa4/rev.112
 * 
 * authors: 
 *   Gustav Delius

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// Click on sketch and use arrow keys to change pattern

int diameter = 160;
int opaque = 20;

void setup() {
  size(480, 480);
  smooth();
  draw_egg()
}

void draw() {
  if (keyPressed && (key == CODED)) {
    if (keyCode == LEFT) {
      diameter--;
    } else if (keyCode == RIGHT) {
      diameter++;
    }
    if (keyCode == DOWN) {
      opaque--;
    } else if (keyCode == UP) {
      opaque++;
    }
    draw_egg()
  }
}

void draw_egg() {
  background(0, 0, 255);
  noStroke();
  fill(255, 0, 0, opaque);
  for (int y = 0; y <= height; y += 40) {
    for (int x = 0; x <= width; x += 40) {
      ellipse(x, y, diameter, diameter);
    }
  }
  strokeWeight(width/2);
  stroke(255);
  noFill();
  ellipse(width/2, height/2, width*1.1, height*1.3);
}