/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://playgramming.sketchpad.cc/sp/pad/view/ro.kIJ9PCOYq$s/rev.12
*
* authors:
* Devon Scott-Tunkin
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
int brushOpacity = 50;
int brushAngle = 45;
int brushScale = 5;
color brushColor = color(0);
void setup() { // this is run once.
size(300, 300);
smooth();
}
void draw() { // this is run repeatedly.
if (keyPressed) {
if (keyCode == UP) {
if (brushOpacity < 255) {
brushOpacity = brushOpacity + 1;
}
}
if (keyCode == DOWN) {
if (brushOpacity > 0){
brushOpacity = brushOpacity - 1;
}
}
if (key == 'w') {
brushScale = brushScale + 1;
}
if (key == 's') {
if (brushScale > 0) {
brushScale = brushScale - 1;
}
}
if (key == 'a') {
brushAngle = brushAngle - 5;
}
if (key == 'd') {
brushAngle = brushAngle + 5;
}
}
if (mousePressed) {
if (mouseButton == LEFT) {
noStroke();
fill(brushColor, brushOpacity);
pushMatrix();
translate(mouseX, mouseY);
rotate(radians(brushAngle));
scale(brushScale, brushScale);
triangle(-1, 1, 0, -1,1, 1);
popMatrix();
}
if (mouseButton == RIGHT) {
brushColor = get(mouseX, mouseY);
}
}
for (int angle = 0; angle < 360; angle = angle + 1) {
colorMode(HSB, 360, 100, 100, 100);
pushMatrix();
translate(30, 30);
rotate(radians(angle));
stroke(angle, 100, 100, 100);
line(0, 0, 30, 0);
popMatrix();
}
colorMode(RGB);
}