> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.NFILDJs10it/rev.187
 * 
 * authors: 
 *   Ari Bader-Natal

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



// Pointillism
// by Daniel Shiffman. Mouse horizontal location controls size of dots. Creates a simple pointillist effect using ellipses colored according to pixels in an image.
// from http://processingjs.org/learning/basic/pointillism 
// Modified to work with images hosted on studio sketchpad.

/* @pjs preload="/static/uploaded_resources/p.8/yosemite.jpg */ 


PImage a;
int mx;

void setup()
{
  a = loadImage("/static/uploaded_resources/p.8/yosemite.jpg");
  size(600,321);
  noStroke();
  background(255);
  smooth();
}

void draw()
{ 
  mx = ceil(1000 * width / frameCount);
  float pointillize = map(mx, 0, width, 2, 18);
  int x = int(random(a.width));
  int y = int(random(a.height));
  color pix = a.get(x, y);
  fill(pix, 126);
  ellipse(x, y, pointillize, pointillize);
}