Wallpaper-05-sehenry

sketch

//Seth Henry

//Tuesday at 10:30

//sehenry@andrew.cmu.edu

//Assignment-05 Wallpaper




function setup() {
    createCanvas(660, 340);
    }

function draw() {
	  background(128, 0, 32); //Burgundy
	  blackDot(); 
	  fill('orange'); //Color of Ball
	  Bball();
	  fill(240, 248, 255); //Color of Diamonds
	  diamond();

	 }


function Bball(){ //Basketball Layout
	var x = 90;
	var y = 50;
	for(x = 90; x < 660; x += 120){
	
	for(y = 50; y < 340; y += 80){
		ellipse(x, y, 60, 60)
		
	  beginShape(); // left curve on basketball
	  
	  curveVertex(x - 19.5, y - 22.5);
	  curveVertex(x - 19.5, y - 22.5);
	  curveVertex(x - 12.5, y - 10);
	  curveVertex(x - 12.5, y + 10);
	  curveVertex(x - 19.5, y + 22.5);
	  curveVertex(x - 19.5, y + 22.5);
	  endShape();
   	  beginShape(); // right curve on basketball
	  
	  curveVertex(x + 19.5, y - 22.5);
	  curveVertex(x + 19.5, y - 22.5);
	  curveVertex(x + 12.5, y - 10);
	  curveVertex(x + 12.5, y + 10);
	  curveVertex(x + 19.5, y + 22.5);
	  curveVertex(x + 19.5, y + 22.5);
	  endShape();
		line(x, y + 30, x, y-30); //vertical line on basketball
		line(x - 30, y, x + 30, y); //horizontal line on basketball
}

}
noLoop();
}


function diamond(){ //Diamond Layout Plus Number 4 Text

var a = 0; //starter variables
var b = 0;


for(a = 0; a < 650; a += 120){ //moves over the diamonds/4 in rows
for(b = 0; b < 340; b += 50){ //moves over the diamonds/4 in columns
quad(a + 30, b + 5, a + 45, b + 20, a + 30, b + 35, a + 15, b + 20);
textAlign(CENTER);

text("#4", a + 30, b + 50); //#4
}	
} 
noLoop(); //end loop
}

function blackDot(){ //Makes black dots behind the balls, numbers, and diamonds
	var v = 0;
	var w = 0;

	for(v=0; v<660; v+=5){ //moves over the dots in rows
		for(w=0; w<340; w+=5){ //moves over the dots in columns
		ellipse(v,w,1,1);
		}
		
	}
	noLoop();
}

	


I decided to cut off one row of the basketballs because when I embed the wallpaper into my post, it cannot capture all of the extra row. So I decided to just remove it from the preview even though it is in my code.

Making this project would have actually been finished relatively fast if I didn’t have a hard time with the curves on the basketball and getting the diamonds to move over by certain amounts without distorting their shape. I drew a sketch to begin with and toyed with the idea of having basketballs all over the picture. I later added the number 4 to the wallpaper because it is my current number on the basketball team and I decided to add the black dots because I thought it would make the wallpaper pop out even more! I had fun with this project and it showed me that I am actually getting better at coding.

wallpaper-sketch

Leave a Reply