Project 4

this is my project 4

sketch
var dx1;
var dy1;
var dx2;
var dy2;
var distance = 5
var numLines = 35;

function setup() {
    createCanvas(400, 300);
    background(0);
    line(250, 0, 25, 25); //top-left
    line(25, 25, 0, 250);
    
    dx1 = -225/numLines;
    dy1 = 25/numLines;
    dx2 = -25/numLines;
    dy2 = 225/numLines;

    line(150, 300, 375, 275);  // bottom right
    line(375, 275, 400, 50);

    bx1 = 225/numLines;
    by1 = -25/numLines;
    bx2 = 25/numLines;
    by2 = -225/numLines;

}

function draw() {

    //top left part
    var x1 = 250;
    var y1 = 0;
    var x2 = 25;
    var y2 = 25;

    stroke(0, 50, 233);

    for (var i = 0; i <= numLines; i += 1) {
        line(x1, y1, x2, y2);
        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;
    }  

    //bottom right
    var a1 = 150;
    var b1 = 300;
    var a2 = 375;
    var b2 = 275;
    for (var i = 0; i <= numLines; i += 1) {
        line(a1, b1, a2, b2);
        a1 += bx1;
        b1 += by1;
        a2 += bx2;
        b2 += by2;
    }

    //circular shape
    push();
    translate(width/2, height/2);
    var x = 200
    var y = 100;

    //pink
    for(y = 10; y <= 500; y += 3) {
        rotate(radians(175));
        strokeWeight(1)
        stroke(244, 82, 255);
        line(x, y, 10, y)
    }
    //blue
    for(y = 40; y <= 400; y+=0.5) {
        rotate(radians(35));
        strokeWeight(0.8)
        stroke(81, 211, 255, 70);
        line(150, y, x+distance, y+distance)
        distance -= 5;
    }

    pop()

    noLoop();
}

Leave a Reply