> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.g8NaL3M5Lb6/rev.2
 * 
 * authors: 
 *   Keith O'Hara
 *   

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



/*
 * 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10
 * http://www.slate.com/articles/technology/books/2012/11/computer_programming_10_print_chr_205_5_rnd_1_goto_10_from_mit_press_reviewed.html
 * Keith O'Hara <[email protected]>
 * Dec 2012
 *
 */

//c64 pallete colors from 
// http://www.blitzbasic.com/Community/posts.php?topic=52312

color[] c64 = {
  #FFFFFF, #744335, #7CACBA, 
  #7B4890, #64974F, #403285, #BFCD7A, 
  #7B5B2F, #4f4500, #a37265, #505050, 
  #787878, #a4d78e, #786abd, #9f9f9f
};

void setup() {
  size(640, 480);
  strokeWeight(5);
  mouseMoved();
}

void mouseMoved() {
  background(0);
  int c = int(map(mouseX, 0, width, 10, 50));
  int i = int(map(mouseY, 0, width, 0, c64.length));
  stroke(c64[i]);
  for (int x = 0; x < width; x += c) {
    for (int y = 0; y < height; y += c) { 
      if (random(1) < .5) {
        line(x + 2, y + 2, x + c - 2, y + c - 2);
      }
      else {
        line(x + 2, y + c - 2, x + c - 2, y + 2);
      }
    }
  }
}

void draw() {
}