xxxxxxxxxx
44
function setup() {
createCanvas(1000, 1000);
//background(255);
let col1 = color('#a1785c');
let col2 = color('#ccb494');
//backgroundGradient(col1, col2);
let col = color('#4B644A');
col.setAlpha(100);
push();
translate(500, height - 50);
rotate(radians(random(20,30)));
let plant1 = new Plant(5, type2, 11, col, 1.3);
plant1.show();
pop();
button = createButton('save image');
button.size(150, 40);
button.style('font-size', '22px');
button.style('background-color', 'white')
button.mousePressed(saveIMG);
}
function backgroundGradient(c1, c2) {
for (let y = 0; y < height; y += 0.5) {
n = map(y, 0, height, 0, 1);
let newc = lerpColor(c1, c2, n);
stroke(newc);
line(0, y, width, y + 1);
}
}
function saveIMG() {
save('LSystem.png')
}
function draw() {
noLoop();
}