Alice Fang – Project 5 – Wallpaper

sketch

/*
Alice Fang
Section E
acfang@andrew.cmu.edu
Project-05-Wallpaper
*/

var citrusSize = 80;

function setup() {
    createCanvas(600, 600);
    background(176, 196, 222);
    noStroke();
}

function draw() {
	var offset = 5; // offset for fruit outlines

	// draw oranges
	for (x = 75; x < width; x += 150){ 
		for (y = 75; y < height; y += 150){
			noStroke();
			fill(244, 164, 96); 
			ellipse(x, y, citrusSize, citrusSize);

			// orange outline
			noFill();
			strokeWeight(5);
			stroke(220, 120, 30);
			ellipse(x + 5, y + 5, citrusSize, citrusSize);

			// orange dot details
			point(x + 20, y - 20);
			point(x + 15, y - 15);
			point(x + 10, y - 20);
		}
	} 
	var citrusX = 150; // width between lemon and lime
 	var citrusY = 150; // height between rows of lemon/lime
 	textStyle(ITALIC);

	// draw lemon and lime wedges
	for (x = 0; x < 6; x++) {
		for (y = 0; y < 5; y++) {
			var px = x * citrusX; // horizontal spacing between wedges
			var py = y * citrusY + 10; // vertical spacing between wedges
			
			if (x % 2 == 1) { // lemon wedges for even columns
				noStroke(); 
				fill(255, 250, 205);
				arc(px, py, citrusSize, citrusSize, 0, PI);
				
				fill(240, 230, 140); // lemon wedge shading
				triangle(px, py+5, px+5, py+30, px-10, py+30);
				triangle(px+2, py, px - 40, py + 10, px-35, py + 25);
				triangle(px+2, py, px+15, py + 30, px+30, py+10);

				text("lemon", px-10, py-50);
			}
			else { // lime wedges for odd columns
				noStroke();
				fill(154, 190, 20); 
				arc(px, py, citrusSize, citrusSize, 0, PI);
			
				fill(200, 255, 80); // lime wedge shading
				triangle(px, py+5, px+5, py+30, px-10, py+30);
				triangle(px+2, py, px - 40, py + 10, px-35, py + 25);
				triangle(px+2, py, px+15, py + 30, px+30, py+10);

				text("lime", px-10, py-50);
			}
			noFill();
			strokeWeight(5); // offset outline (citrus rind)
			stroke(255, 215, 10);
			arc(px - offset, py - offset, citrusSize, citrusSize, 0, PI);
		}
	}
	noLoop();	
}

This was inspired by a pajama set that I own, and my own affinity for citrus prints (I also own a tshirt that has a different style of citrus illustration). For some reason, I’m drawn to these fruits, and I thought it would be an interesting way to combine the two different citrus clothing that I own. It was definitely good practice in nested loops, and getting more familiar with the % operator, since I wrote the lemons and limes separately before deciding to combine them into a nested for loop.

The pajama set with lemons and other fruit
Explorations of citrus illustration

Leave a Reply