/*Sharon Yang
Section C
junginny
Project-04
*/
function setup() {
createCanvas(400, 300);
}
function draw() {
background(255);
var x1;
var x2;
var y1;
var y2;
var colorLR = 20;
var colorLG = 45;
var colorLB = 80;
//Left curve
x1 = 0;
x2 = 0;
y1 = 0;
y2 = 0;
push();
for (var jL = 1;jL <= 100; jL+=1) {
translate(jL,jL);
strokeWeight(1-(jL/20));
stroke(colorLR,colorLG,colorLB);
for (var iL = 1;iL <= 50; iL+=2.8) {
x2 = iL*8;
y1 = iL*6;
line(x1-jL,height-y1-jL,x2-jL,y2-jL);
}
//Change color value - gradient
colorLR+=10;
colorLG+=10;
colorLB+=10;
}
pop();
//Right curve - resetting variables
x1 = 0;
x2 = 0;
y1 = 0;
y2 = 0;
colorLR = 25;
colorLG = 50;
colorLB = 90;
push();
for (var jR = 1;jR <= 100; jR+=1) {
translate(-jR,jR);
strokeWeight(1-(jR/20));
stroke(colorLR,colorLG,colorLB);
for (var iR = 1;iR <= 50; iR+=2.8) {
x1 = iR*8;
y2 = iR*6;
line(x1,0,width,y2);
}
//Change color value - gradient
colorLR+=10;
colorLG+=10;
colorLB+=10;
}
pop();
}
Using for loops to create various lines to put them together into a harmonious art piece helped me explore the order in for loops and/or nested for loops. I played with the stroke weights as well as the colors to create an effect of a gradient.