Project03 – Aleax

sketch

//Alexander Chen
//Section A
//alchen1@andrew.cmu.edu
//Project03

var circleSize = 0

function setup() {
    createCanvas(640, 480);
    background(0);
}

function draw() {

//RECTANGLES//
	//top half
	noStroke();
	if (mouseX < width / 2) {
		fill ("red");
	}
	if (mouseX > width / 2) {
		fill ("blue");
	}
	rect (0, 0, width, height / 2)

	//top half
	noStroke();
	if (mouseX > width / 2) {
		fill ("yellow")
	}
	if (mouseX < width / 2) {
		fill ("green");
	}
	rect (0, height / 2, width, height / 2);

//MIDDLE CIRCLES//
	// middle circle (small)
	strokeWeight(5);
	if (mouseX < width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX > width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX < width / 2) {
		stroke(255);
	}
	if (mouseX > width / 2) {
		stroke(0);
	}

	noFill();
	ellipse (width / 2, height / 2, circleSize, circleSize);

	// middle circle (medium)
	strokeWeight(5);
	if (mouseX < width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX > width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX < width / 2) {
		stroke(255);
	}
	if (mouseX > width / 2) {
		stroke(0);
	}
	
	noFill();
	ellipse (width / 2, height / 2, circleSize - 30, circleSize - 30);	

	// middle circle (big)
	strokeWeight(5);
	if (mouseX < width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX > width / 2) {
		circleSize = width / 2 - mouseX
	}
	if (mouseX < width / 2) {
		stroke(255);
	}
	if (mouseX > width / 2) {
		stroke(0);
	}

	noFill();
	ellipse (width / 2, height / 2, circleSize - 60, circleSize - 60);

//SIDE TRIANGLES//
	//right triangle 1
	noStroke();
	fill("purple");
	if (mouseY < height / 2) {
		triangle(width - 30, mouseY - 20, width - 10, mouseY - 20, width - 20, mouseY)
	}
	if (mouseY > height / 2) {
		triangle(width - 20, mouseY, width - 30, mouseY + 20, width - 10, mouseY + 20)
	}

	//right triangle 2
	fill("purple");
	if (mouseY < height / 2) {
		triangle(width - 60, mouseY - 50, width - 40, mouseY - 50, width - 50, mouseY - 30)
	}
	if (mouseY > height / 2) {
		triangle(width - 50, mouseY + 30, width - 60, mouseY + 50, width - 40, mouseY + 50)
	}
	
	//right triangle 3
	fill("purple");
	if (mouseY < height / 2) {
		triangle(width - 90, mouseY - 80, width - 70, mouseY - 80, width - 80, mouseY - 60)
	}
	if (mouseY > height / 2) {
		triangle(width - 80, mouseY + 60, width - 90, mouseY + 80, width - 70, mouseY + 80)
	}

	//left triangle 1
	fill("purple");
	if (mouseY < height / 2) {
		triangle(30, mouseY - 20, 10, mouseY - 20, 20, mouseY)
	}
	if (mouseY > height / 2) {
		triangle(20, mouseY, 30, mouseY + 20, 10, mouseY + 20)
	}

	//left triangle 2
	fill("purple");
	if (mouseY < height / 2) {
		triangle(60, mouseY - 50, 40, mouseY - 50, 50, mouseY - 30)
	}
	if (mouseY > height / 2) {
		triangle(50, mouseY + 30, 60, mouseY + 50, 40, mouseY + 50)
	}
	
	//left triangle 3
	fill("purple");
	if (mouseY < height / 2) {
		triangle(90, mouseY - 80, 70, mouseY - 80, 80, mouseY - 60)
	}
	if (mouseY > height / 2) {
		triangle(80, mouseY + 60, 90, mouseY + 80, 70, mouseY + 80)
	}
}

This project definitely helped me think really creatively due to the open-ended nature of the project. My inspirations for this project was different flags of different countries as well as airplane shows. I think the challenge of this project was to think creatively with the "if" conditional sentences.

Leave a Reply