/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.g7I6We$Z6r0/rev.2
*
* authors:
* GoToLoop
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
/**
* ClickLine (v2.0)
* by GoToLoop (2013/Apr)
*
* http://forum.processing.org/topic/mouse-click
* http://forum.processing.org/topic/drawing-lines-with-user-defined-coordinates
*
*/
final static color BG = #4080A0, FG = #FFFF00;
final static short BOLD = 3, FPS = 30;
void setup() {
size(600, 400);
frameRate(FPS);
noLoop();
smooth();
background(BG);
stroke(FG);
strokeWeight(BOLD);
}
void draw() {
println(mouseX + "\t" + mouseY);
if ( (frameCount & 1) == 0 ) {
background(BG);
point(mouseX, mouseY);
return;
}
line(pmouseX, pmouseY, mouseX, mouseY);
println();
}
void mouseClicked() {
redraw();
}