//Jenny Zhang
//Section D
//jennyzha@andrew.cmu.edu
//Project 05: Wallpaper
var tw = 0;
var th = 0;
var oy = 0;
var ox = 0;
function setup() {
createCanvas(480,480);
background(179, 217, 255);
}
function draw() {
background(180, 215, 255);
var tw = 55;
var th = 55;
var oy = 45;
var ox = 45;
for (var x = 0; x < width; x = x + 1) {
for (var y = 0; y < 8; y += 1) {
stroke(255);
point(x, (y * 100) + 60 - 50 * sin(radians(x)));
stroke(255, 255, 0);
point(x, (y * 100) + 60 - 50 * cos(radians(x)));
}
}
for (var y = 0; y < 7; y += 2) { //writes the code for the circles on every odd x and y value
for (var x = 0; x < 7; x+= 1.5) {
var py = oy +y *th;
var px = ox +x *tw;
fill(185,145,255);
noStroke();
rect(px, py, 50, 50);
noStroke();
rect(px, py, 60, 60);
}
}
for (var y = 0; y < 7; y += 2) { //writes the code for the circles on every odd x and y value
for (var x = 0; x < 7; x+= 1.5) {
var py = oy +y *th;
var px = ox +x *tw;
fill(255);
noStroke();
rectMode(RADIUS);
rect(px, py, 25, 25);
rectMode(RADIUS);
noStroke();
rect(px, py, 25, 25);
}
}
for (var y = 0; y < 7; y += 2) { //writes code for the circles of every even value -- these two loops help to create the honeycomb-like off-set grid
for (var x = 1; x < 7; x+= 1.5) {
var py = oy +y *th;
var px = ox +x *tw;
noStroke();
fill(255, 255, 225);
ellipse(px, py, 30, 30);
}
}
for (var y = 0; y < 7; y += 2) { //writes code for the circles of every even value -- these two loops help to create the honeycomb-like off-set grid
for (var x = 1; x < 7; x+= 1.5) {
var py = oy +y *th;
var px = ox +x *tw;
noStroke();
fill(255);
ellipse(px, py, 15, 15);
}
}
noLoop();
}
For this project, I was inspired by assignment 05B for this week’s deliverables. I wanted to gain a deeper understanding of how the program worked and added a couple more shapes, lines, and colors to make it my own and make it into a more aesthetically pleasing wallpaper.