/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://hewitt.sketchpad.cc/sp/pad/view/ro.3Hqiw8yDDJS/rev.4
*
* authors:
* Marina King
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
//Stars by Marina King
void setup() {
size(400,400);
background(255);
noStroke();
smooth();
}
void draw() {
}
void mousePressed() {
star();
}
void star() {
int number = 0;
if(mouseX > 0 && mouseX < width/6) {
number = 10;
} else if(mouseX >= width/6 && mouseX < width/6*2) {
number = 20;
} else if(mouseX >= width/6*2 && mouseX < width/6*3) {
number = 30;
} else if(mouseX >= width/6*3 && mouseX < width/6*4) {
number = 50;
} else if(mouseX >= width/6*4 && mouseX < width/6*5) {
number = 70;
} else {
number = 100;
}
float x,y,r,g,b;
r = random(255);
g = random(255);
b = random(255);
background(r,g,b);
for(int i=0;i<number;i++) {
y = random(height-80)-25;
x = random(width-80)-85;
r = random(255);
g = random(255);
b = random(255);
stroke(r,g,b);
strokeWeight(3);
line(x+110,y+ 50,x+ 120,y+25);
line(x+120,y+ 25,x+135,y+50);
line(x+135,y+50,x+160,y+50);
line(x+160,y+50,x+135,y+70);
line(x+135,y+70,x+150,y+95);
line(x+150,y+95,x+120,y+80 );
line(x+110,y+50,x+85,y+55);
line(x+85,y+55,x+100,y+70);
line(x+100,y+70,x+85,y+95);
line(x+85,y+95,x+120,y+80);
}
}