This is happy fun doodling. |
A script for nonstop doodling fun
The script randomly loads an image from an array of preloaded black and white images. A cross-hair cursor hovers over your mouse coordinates.
_CLICK to start doodling.
_HOLD+DRAG to create shapes.
_DOUBLE-CLICK to reload a new randomized image.
// doodleFunTimes
// sarah churng . mallika simone .
// 2013.04.12
// Creates a sketch board. Images are drawn by clicking down and dragging mouse.
// GLOBALS
// cursor dot radius
int r = 8;
// FUNCTIONS
void reloadImage() {
//Creates a new background gray with each new load
PImage[] images = new PImage[8];
for( int i = 0; i < images.length; i++ ) {
images[i] = loadImage("img" + i + ".jpg");
}
int img = int(random(images.length));
image(images[img], 0, 0, 600, 400);
}
void setup(){
size(600, 400);
smooth();
//Slows down frame rate so that mouse interactions are visible
frameRate(12);
reloadImage();
fill(246, 12, 108);
text("CLICK AND DRAG TO DRAW. \nDOUBLE-CLICK TO START OVER.",10,20);
}
void draw(){
noStroke();
cursor(CROSS);
if (mousePressed) {
//place a red dot over hover area
fill(252, 255, 68);
ellipse(mouseX, mouseY, r, r);
//replace previous frame's red dot with a gray dot
fill(246, 12, 108);
ellipse(pmouseX, pmouseY, r, r);
//connect previous dots with line
stroke(246, 12, 108);
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
// starts over when mouse is double-clicked
void mousePressed() {
if (mouseEvent.getClickCount()==2) {
reloadImage();
}
}
More screenshots of other doodles.
Code and images archive is available at:
https://docs.google.com/file/d/0B0ba9G5aWnFvcml1SVJnUDdZWDg/edit?usp=sharing
No comments:
Post a Comment