xxxxxxxxxx
26
//Now the sprinkles are random on the Y axis
function setup() {
createCanvas(400, 200);
background("LemonChiffon");
//The loop code
//Top border
for (var x = 0; x < width; x += 30) {
noStroke();
fill("SaddleBrown");
ellipse(x, 10, 45);
}
//Bottom border
for (x = 0; x < width; x += 30) {
ellipse(x, 190, 45);
}
//Random sprinkles
for (x = 5; x < width; x += 40) {
var y = random(height / 2 + 40, height / 2 - 40);
rect(x, y + 10, 30, 10, 5);
}
}