/*
Romi Jin
Section B
rsjin@andrew.cmu.edu
Project-05
*/
//var x = 0;
//var y = 0;
var faceWidth = 40;
var earWidth = 15;
var earHeight = 40;
var bodyWidth = 40;
var bodyHeight = 60;
var tailWidth = 20;
var body2w = 50;
var body2h = 40;
var eyew = 3;
var eyeh = 5.5;
var nosew = 6;
var noseh = 5;
function setup() {
createCanvas(600, 600);
}
function draw() {
background(252,236,235);
bunny();
for (var x = 35; x < width-35; x += 75) {
for (var y = 135; y < height; y += 150) {
bunny(x,y);
}
}
noLoop();
}
function bunny(x,y) {
//left ear
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x,y-100,earWidth,earHeight);
//right ear
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x-10,y-95,earWidth,earHeight);
//body
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x,y-30,body2w,body2h/2);
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x,y-40,bodyWidth,bodyHeight);
//tail
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x-10,y-15,tailWidth,tailWidth);
//face
stroke(128,128,128);
strokeWeight(.2);
fill(255);
ellipse(x,y-75,faceWidth,faceWidth);
//eye
noStroke();
fill(0);
ellipse(x-10,y-80,eyew,eyeh);
//nose
noStroke();
fill(237,171,166);
ellipse(x+14,y-75,nosew,noseh);
}
For this project, I wanted to make a simple wallpaper of bunnies! I discovered that this project was easier than I thought it would be. I simply made a new function called “bunny” and placed all the features of the bunny in it, then referenced that function in the for loop (in the draw function).