letw,n;functionsetup(){w=min(windowWidth*0.9,500);cnv=createCanvas(w,w);describe("monotone blue landscape drawn with triangles and circles for stars and moon");stroke(50,60,80);noLoop();strokeWeight(0.5);n=int(random(500,1000))}functiondraw(){translate(w/2,w/2)fill(255)background(50,60,80)noStroke()letx=random(-w/5,w/5)lety=random(-w/3,0)letr=random(w/5,w/3)circle(x,y,r)fill(50,60,80,240)circle(x+random(-w,w),y,random(w/2.5,w/1.5))fill(255)for(leti=0;i<1000;i++){tx=random(-w/2,w/2)ty=random(-w/2,w/2)if(dist(tx,ty,x,y)>r/2){circle(tx,ty,1)}}for(leti=0;i<n;i++){r1=random(5,10)r2=random(10,50)fill(30-r1,40-r1,60-r1)stroke(30+3*r1,40+3*r1,60+3*r1)x1=random(-w,w/3)x2=x1+random(w/10,w)x3=(x1+x2)/2y3=randomGaussian(w/3,-w/5)triangle(x1,w/2,x2,w/2,x3,y3)if(x3<=x){fill(30+r2,40+r2,60+r2);triangle(x1+x2/2,w/2,x2,w/2,x3,y3)fill(30-r1,40-r1,60-r1);triangle(x1+x2/2,w/2,x1,w/2,x3,y3)}else{fill(30-r1,40-r1,60-r1);triangle(x1+x2/2,w/2,x2,w/2,x3,y3)fill(30+r2,40+r2,60+r2);triangle(x1+x2/2,w/2,x1,w/2,x3,y3)}}}functionmousePressed(){setup();draw();}functionkeyPressed(){if(keyCode===83){save(cnv,"landscape","jpg");}}