sketch
My art is inspired by a logo that i quite like and it was fun recreating it as a wallpaper. It was a challenge to create complex and organic/natural pattern using simply a double for loop and little hard coding for each one specific cell. Creating a if statement that was able to create a pattern with the colors was also interesting to think about.
//Alvin Luk
//Section A
//akluk@andrew.cmu.edu
//Assignment-05-B
var total; //variable that controls the number of circles at current row
var w = 90;
var sx = w/2;
var sy = w/2;
function setup() {
createCanvas(450, 450);
background(color(119,221,170));
for (var y = 0; y < height/w; y++) {
for (var x = 0; x < width/w; x++) {
//determines color of the heart
if ((y*5+x)%2 == 0){
fill(color(255,20,20));
}
else if (x%2 == 1){
fill(color(255,105,180));
}
else {
fill(color(255,215,0));
}
noStroke();
//draws heart outline
ellipse(sx+x*w-10, sy+y*w-10,20,20);
ellipse(sx+x*w+10, sy+y*w-10,20,20);
triangle(sx+x*w-20,sy+y*w-7,sx+x*w+20,sy+y*w-7,sx+x*w,sy+y*w+18)
//draws eye whites
fill(255);
ellipse(sx+x*w-9, sy+y*w-7,10,6);
ellipse(sx+x*w+9, sy+y*w-7,10,6);
//draws pupils
fill(0);
ellipse(sx+x*w-9, sy+y*w-7,5,6);
ellipse(sx+x*w+9, sy+y*w-7,5,6);
}
}
//draws line grid
for (var i = 0; i < 4 ; i++){
stroke(0);
strokeWeight(2);
line(w*(i+1)-3,0,w*(i+1)-3,height);
line(w*(i+1)+3,0,w*(i+1)+3,height);
line(0,w*(i+1)-3,width,w*(i+1)-3);
line(0,w*(i+1)+3,width,w*(i+1)+3);
}
//draws purple loops around intersection
for (var j = 0; j < 4 ; j++){
for (var k = 0; k < 4; k++){
noFill();
stroke(106,90,205);
strokeWeight(4);
ellipse(w*(j+1),w*(k+1),20,20);
}
}
noLoop();
}
function draw() {
// draw is not called due to noLoop() in setup()
}