Project 05 – Min Lee

sketch

function setup() {
    createCanvas(600, 600);
    background(169, 209, 226);
}

function draw() {
	// milk boxes 
	var xPosition = 0;
	var yPosition = 0;
	translate(0, -50);
	fill(255);

	for (var y = 1; y < 12; y++) {
		for (var x = 0; x < 10; x++) {
			if (y % 2 == 0) {
				var spaceX = 90;
				var spaceY = 60;
				//milk face
				quad(xPosition + spaceX * x, yPosition + spaceY * y,
				xPosition + 50 + spaceX * x, yPosition + spaceY * y, 
				xPosition + 50 + spaceX * x, yPosition + 70 + spaceY * y, 
				xPosition + spaceX * x, yPosition + 70 + spaceY * y);
				//milk side
				quad(xPosition + 50 + spaceX * x, yPosition + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x, yPosition - 12 + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x, yPosition + 58 + spaceY * y, 
				xPosition + 50 + spaceX * x, yPosition + 70 + spaceY * y);
				//milk middle
				quad(xPosition + spaceX * x, yPosition + spaceY * y, 
				xPosition + 50 + spaceX * x, yPosition + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x, yPosition - 22 + spaceY * y, 
				xPosition + 10 + spaceX * x, yPosition - 22 + spaceY * y);
				//milk top
				quad(xPosition + 10 + spaceX * x, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x, yPosition - 22 - 3 + spaceY * y, 
				xPosition + 10 + spaceX * x, yPosition - 22 - 3 + spaceY * y)
				//milk triangle
				triangle(xPosition + 50 + spaceX * x, yPosition + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x, yPosition - 12 + spaceY * y);
				//box crease
				line(xPosition + 50 + 6 + spaceX * x, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x, yPosition - 7 + spaceY * y)
				//milk eyes
				push();
				fill(0);
				ellipse(xPosition + 16 + spaceX * x, yPosition + spaceY * y + 20, 3, 3);
				ellipse(xPosition + 32 + spaceX * x, yPosition + spaceY * y + 20, 3, 3);
				curve(xPosition + 16 + spaceX * x, yPosition + spaceY * y + 20, 
					xPosition + 20 + spaceX * x, yPosition + spaceY * y + 20 + 6,
					xPosition + 32 + spaceX * x - 2, yPosition + spaceY * y + 20 + 6,
					xPosition + 32 + spaceX * x, yPosition + spaceY * y + 20)
				pop();

			} else {
				var spaceX = 75;
				var spaceY = 60;
				//milk face
				quad(xPosition + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y,
				xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y, 
				xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + 70 + spaceY * y, 
				xPosition + spaceX * x + 18 * x + spaceX / 8, yPosition + 70 + spaceY * y);
				//milk side
				quad(xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x + 18 * x + spaceX / 8, yPosition - 12 + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x + 18 * x + spaceX / 8, yPosition + 58 + spaceY * y, 
				xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + 70 + spaceY * y);
				//milk middle
				quad(xPosition + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y, 
				xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y, 
				xPosition + 10 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y);
				//milk top
				quad(xPosition + 10 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 - 3 + spaceY * y, 
				xPosition + 10 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 - 3 + spaceY * y)
				//milk triangle
				triangle(xPosition + 50 + spaceX * x + 18 * x + spaceX / 8, yPosition + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 15 + spaceX * x + 18 * x + spaceX / 8, yPosition - 12 + spaceY * y);
				//box crease
				line(xPosition + 50 + 6 + spaceX * x + 18 * x + spaceX / 8, yPosition - 22 + spaceY * y, 
				xPosition + 50 + 7 + spaceX * x + 18 * x + spaceX / 8, yPosition - 7 + spaceY * y)
				//milk eyes
			};
		};
	};
}

For this project I wanted to create a wallpaper full of cute milk boxes with different faces, but I came across a problem trying to create the second face, so it’s not as cute. I’d still drink it.

Leave a Reply