> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.EbRajuV9e9O/rev.8
 * 
 * authors: 
 *   GoToLoop

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



/** 
 * Stamp-a-Pup (Classless PVector Remix v1.02)
 * by  ChalupaBatmans (2014/Jan)
 * mod Asimes & GoToLoop
 *
 * Forum.Processing.org/two/discussion/3919/confusion-with-the-pvector#Item_5
 * Forum.Processing.org/two/discussion/2396/how-to-turn-this-into-an-arraylist
 *
 * Studio.ProcessingTogether.com/sp/pad/export/ro.93n3OpWs89REU
 * Studio.ProcessingTogether.com/sp/pad/export/ro.9jCT0UHalHCI3
 */

import java.util.List;
final List<PVector> puppies = new ArrayList<PVector>();

static final color BG  = #4168F0, FUR = #7E2C06;
static final short DIM = 0100;

void setup() {
  size(1000, 650);
  noLoop();
  smooth(3);
  noStroke();
  ellipseMode(CENTER);
}

void draw() {
  background(BG);
  for (final PVector p : puppies)  render(p);
}

void mousePressed() {
  if (mouseButton == LEFT)  puppies.add(new PVector(mouseX, mouseY));
  else if (!puppies.isEmpty())  puppies.remove(0);

  redraw();
}

void render(final PVector pup) {
  final float x = pup.x, y = pup.y;

  // Head & Body:
  fill(FUR);
  ellipse(x, y, DIM, DIM);
  ellipse(x, y + DIM, DIM*1.2, DIM*1.2);

  // Ears:
  fill(0);
  ellipse(x - DIM*.44, y + DIM*.1, DIM*.3, DIM*.8);
  ellipse(x + DIM*.44, y + DIM*.1, DIM*.3, DIM*.8);

  // Mouth & Eyes:
  fill(-1);
  ellipse(x, y + DIM*.2, DIM*.3, DIM*.3);
  ellipse(x - DIM*.2, y - DIM*.1, DIM*.2, DIM*.2);
  ellipse(x + DIM*.2, y - DIM*.1, DIM*.2, DIM*.2);

  // Nose & Irides:
  fill(0);
  ellipse(x, y + DIM*.1, DIM*.16, DIM*.16);
  ellipse(x - DIM*.14, y - DIM*.16, DIM*.1, DIM*.1);
  ellipse(x + DIM*.26, y - DIM*.16, DIM*.1, DIM*.1);
}