xxxxxxxxxx
24
let bg; //variable for the background image
function setup() {
createCanvas(500, 500);
bg = loadImage('grassImage.jpg');
beaverImage = loadImage('beaver.png-removebg-preview.png');
}
function draw() {
background(bg);
//setting the grass background
for(let i = 1;i<7;i+=2){//managing the x coordinate of the circles and the image
for (let j=1;j<7;j+=2){//managing the y coordinate of the circles and the image
strokeWeight(2);
imageMode(CENTER);
stroke(255, 255, 238);
fill(221, 255, 238);
let x = i*70 + 25;
let y = j*50 + 175;
let circleWidth = 120
let circleHeight = 50;
ellipse(x,y,circleWidth,circleHeight);
image(beaverImage,x,y-20,100,100);
}
}
}