/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.5Joy3G2eXOx/rev.360
*
* authors:
* Sergio Majluf
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// now we add variables to replace weight and stroke values
float lineWeight = 20;
float lineHue = 255;
float lineSaturation = 250;
float lineBrightness = 250;
float lineAlpha = 30;
int count = 0;
void setup() {
size(200,200);
background(255);
// added
smooth(); // for smooth lines
frameRate(60); // setting it fixed
colorMode(HSB); // default is RGB but Hue Saturation Brightness is easier
}
void draw() {
strokeWeight(lineWeight); // let's change the width
stroke (lineHue, lineSaturation, lineBrightness, lineAlpha); // red, saturated, bright and translucent
if(mousePressed) line (pmouseX,pmouseY,mouseX,mouseY);
}
// we can create custom functions, that run only when certain criteria is met
void keyPressed() {
if(key == 'b') {
background(255);
}
if(key == 's') {
save("filename"+count+".png");
println(count);
count++; // this variable has to be declared at the top
}
}