//Zining Ye
//15104 lecture 1 recitation C
//ziningy1@andrew.cmu.edu
//Project-05
function setup() {
createCanvas(480, 480)
}
function draw() {
background(40,40,40,40);
//set intervals for spacings
var vinterval=100
var hinterval=150
//start for loop for grids
for (var y = 0; y < 7; y++) {
if(y%2){ //if statement determine the even number row
for (var x = 0; x < 7; x++){
//set variable for triangle three vertexs' position
var tx1=60+x*hinterval;
var ty1=y*vinterval;
var tx2=x*hinterval;
var ty2=60+y*vinterval;
var tx3=120+x*hinterval;
var ty3=60+y*vinterval;
stroke(30,50,230,60);
strokeWeight(3);
noFill();
//draw the overlapping three triangles(mountains) with offsets
triangle(tx1+hinterval/2,ty1,tx2+hinterval/2,ty2,tx3-10+hinterval/2,ty3);
stroke(170,170,30);
triangle(tx1+hinterval/2+30,ty1+10,tx2+20+hinterval/2,ty2+10,tx3+20+hinterval/2,ty3+10);
stroke(20,200,50);
triangle(tx1+40+hinterval/2,ty1-10,tx2+60+hinterval/2,ty2+5,tx3+hinterval/2,ty3+5);
//set variables for the ellipse(sun)and draw the ellipse on the top left of the mountain
var ey = 30 + y * vinterval;
var ex = 30 + x * hinterval;
fill(240,120,80,70);
stroke(200,200,50);
ellipse(ex+hinterval/2, ey-10, 30, 30);
}
} else {
for (var x = 0; x < 7; x++){
//for odd number rows, again set variable for triangle three vertexs' position
var tx1=60+x*hinterval;
var ty1=y*vinterval;
var tx2=x*hinterval;
var ty2=60+y*vinterval;
var tx3=120+x*hinterval;
var ty3=60+y*vinterval;
stroke(30,50,230,60);
strokeWeight(3);
noFill();
triangle(tx1,ty1,tx2,ty2,tx3-10,ty3);
stroke(170,170,30);
triangle(tx1+30,ty1+10,tx2+20,ty2+10,tx3+20,ty3+10);
stroke(20,200,50);
triangle(tx1+40,ty1-10,tx2+60,ty2+5,tx3,ty3+5);
//set variable for sun position and draw the sun
var ey = 30 + y * vinterval;
var ex = 30 + x * hinterval;
fill(240,50,80,60);
noStroke();
ellipse(ex,ey-10,30,30);
// draw the ellipses(clouds like)
fill(200,200,200,60);
strokeWeight(2);
ellipse(ex+20,ey,60,20);
ellipse(ex+50,ey+5,50,10);
}
}
}
}
In this project, i was inspired by the strong geometric shapes in some clothing patterns. I also think that using the neon primary color will be a interesting choice against a black background. Building on top of what I learned from the Assignment b, my foundation pattern is a mountains with sun scenery constructed by mostly outlines.