
Processing Pen Tool Simple
By:
BrokenStylus on
Sep 14th, 2013 | syntax:
None | size: 0.79 KB | hits: 6 | expires: Never
//Processing Draw Tool (black and white)
//COPYPASTA BELOW INTO PROCESSING WINDOW AND CLICK THE PLAY BUTTON
/*Instructions
Wait a few seconds after hitting the play button
Left click Black Pen
Right click Eraser
*/
int paletteBlack = 0;
int paletteWhite = 255;
void setup() {
size(displayWidth, displayHeight);
smooth(4);
background(255);
ellipseMode(CENTER);
}
void draw() {
if (mousePressed && (mouseButton == LEFT)) {
stroke(paletteBlack);
strokeWeight(10);
fill(paletteBlack);
line(mouseX, mouseY, pmouseX, pmouseY);
}
else if (mousePressed && (mouseButton == RIGHT)) {
stroke(paletteWhite);
strokeWeight(20);
fill(paletteWhite);
line(mouseX, mouseY, pmouseX, pmouseY);
}
else {
noFill();
noStroke();
}
}