project 4

sketch
//Keng Pu (Paul) Li
//section A 
//9/24/22

var numLines = 50;
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;

function setup() {
    createCanvas(300,400);
    background(220,50,100);
//triangle
    dx1 = 5;
    dy1 = 5;
    dx2 = 10;
    dy2 = 10;
//most left
    dx3 = 5;
    dy3 = 1;
    dx4 = 5;
    dy4 = 5;
//blue
    dx5 = 7;
    dy5 = 1;
    dx6 = 5;
    dy6 = 5;
//dark blue line
    dx7 = 5;
    dy7 = 1;
    dx8 = 15;
    dy8 = 15;

//very dark
    dx9 = 10;
    dy9 = 7;
    dx10 = 20;
    dy10 = 5;
}

function draw() {
    background(220,50,100);
//most left 
    x3 = 0;
    y3 = width/2+100;
    x4 = width/2;
    y4 = width/2+100;
    for(var i = 0; i<40; i++){
        strokeWeight(2);
        stroke(200,90,180);
        line(x3,y3,x4,y4);
        x3 += dx3;
        y3 += dy3;
        x4 -= dx4;
        y4 += dy4;
    }
    //triangle
    x1 = width/2;
    y1 = width/2+100;
    x2 = width/2;
    y2 = width/2+100;
    for(var i = 0; i<100; i++){
        strokeWeight(3);
        stroke(0,20,20,70);
        line(x1,y1,x2,y2);
        x1 += dx1;
        y1 += dy1;
        x2 -= dx2;
        y2 += dy2;
    }
 //dark blue line
    x7 = width-170;
    y7 = 50;
    x8 = width/2+70;
    y8 = width;
    for(var i = 0; i<100; i++){
        strokeWeight(1);
        stroke(50,10,190);
        line(x7,y7,x8,y8);
        x7 += dx7;
        y7 += dy7;
        x8 -= dx8;
        y8 += dy8;
    }

//blue line
    x5 = 0;
    y5 = width/2;
    x6 = width/2+50;
    y6 = width;
    for(var i = 0; i<90; i++){
        strokeWeight(0.5);
        stroke(110,110,255);
        line(x5,y5,x6,y6);
        x5 += dx5;
        y5 += dy5;
        x6 -= dx6;
        y6 += dy6;
    }


    //very dark lines
    x9 = width/2+50;
    y9 = -100;
    x10 = width;
    y10 = height;
    for(var i = 0; i<100; i++){
        strokeWeight(0.5);
        stroke(50,10,90);
        line(x9,y9,x10,y10);
        x9 += dx9;
        y9 += dy9;
        x10 -= dx10;
        y10 += dy10;
    }
}

Leave a Reply