xxxxxxxxxx
49
/*
drawing with functions
3.30.2024
*/
function setup() {
createCanvas(600, 400);
landscape();
}
function landscape() {
background("lightblue");
fill ("green");
noStroke();
rect(0, 300, width, 100);
for (var x = 50; x <= width; x += 50) {
var y = random(20, 140)
cloud(x, y, 'yellow');
//cloud(x, y, 'blue'); //cloud(400, 50, 'blue');
}
cloud(100, 100, 'pink');
cloud(200, 50, 'purple');
cloud(500, 100, 'orange');
tree(100,220, 80);
tree(200,220, 100, "yellow");
tree(300,220, 200);
tree(400,220, 300);
tree(500,220, 400);
}
function cloud(x, y, c) {
fill(c);
circle(x, y, 50);
circle(x + 20, y + 20, 50);
circle(x - 20, y + 20, 50);
}
function tree(x, y) {
fill('brown');
rect(x, y, 20, 100, 5);
fill ('green');
circle(x + 10, y, 80);
}