...i dont know..=(
in
Programming Questions
•
1 year ago
This is my sketch. unfortunately, it doesn't work like it should. so the question: does anyone know how to connect the green brush tool (which should work also in the foreground of the landscape) with the landscape (the landscape is used to change whenever the "l" key is pressed, but that only works when the brush tool is uncommented)?
also, every time i use the brush tool, the clouds dont have a stroke anymore...i dont know how to prevent that...
please, someone help me! i would be so relieved!!!!!!
THANK YOU! =)
void setup() {
smooth();
size(840, 460);
background(160, 230, 220);
}
int seed = 0;
void draw() {
if(mousePressed){
for (int i=0; i<140; i+=1) {
strokeWeight(0.3);
fill(random(030),random(0,20),250,2);
ellipse(mouseX+random(0,30),mouseY+random(0,40),random(20,80),random(30,60));fill(0,0,250,90);
}
}
// noStroke();
// float x2 = width/2+ sin(frameCount/90.0)*250;
// float y2 = height/2+ cos(frameCount/90.0)*250;
//
//
//
// for (int i=0; i<140; i+=1) { //sonne
//
// fill(250, 226, 10, 255-(255/50)*i+100);
// ellipse(x2, y2, 40+i, 40+i);
// }
//}
if(keyPressed){
if(key=='r'){
//green brush
noStroke();
fill(random(20,35),random(49,59),36,50);
if(key=='r')ellipse(mouseX,mouseY,40,40);
}
}
}
void keyPressed() {
if(key=='b'){
randomSeed(seed);
//landscape
strokeWeight(2);
float noiseScale=0.009;
for ( int i=100;i<222;i+=30) {
fill(183-((183-23)/120)*i, 135-((135-124)/120)*i, 252-((252-19)/120)*i);
float rand=random(random(300));
beginShape();
vertex(0, height);
for (int x=0; x < width; x++) {
float noiseVal = noise((rand+x)*noiseScale, rand*noiseScale);
vertex(x, noiseVal*90+i/3+height/2-60);
}
vertex(width, height);
endShape();
}
seed++;
}
}
1