How can I make it so that the grass is “cut” at a certain height?
I think I should be changing something in line 21, but not sure… also, when the grass is cut, all that happens is a white rectangle is being placed over it
function setup() {
createCanvas(400, 200);
colorMode(HSB);
}
var x = 0;
var h = 10;
function draw() {
stroke(random(60, 70), 100, 90);
line(x, height-10, x+random(-10, 10), height-10-random(h));
noStroke();
x = x + 10;
if (x > width) {
x = random(10);
h = h + 3;
}
if (random() > 0.999) {
fill(255);
rect(0, 0, width, height-15);
h = 10;
}
fill(40, 100, 60);
rect(0, height-10, width, 10);
}