Project 03: Dynamic Drawing

sketch
// John Henley; 15-104 section D

function setup() {
    createCanvas(500, 500);
}

function draw() {
    background(0);
    strokeWeight(2);
    noFill();
    
    // top-originating lines
    stroke(mouseX/10, 175, mouseY/10);
    curve(width, height, mouseY/10, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/9, 175, mouseY/9);    
    curve(width, height, mouseY/9, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/8, 175, mouseY/8);    
    curve(width, height, mouseY/8, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/7, 175, mouseY/7);    
    curve(width, height, mouseY/7, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/6, 175, mouseY/6);    
    curve(width, height, mouseY/6, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/5, 175, mouseY/5);    
    curve(width, height, mouseY/5, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/4, 175, mouseY/4);    
    curve(width, height, mouseY/4, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/3, 175, mouseY/3);    
    curve(width, height, mouseY/3, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/2, 175, mouseY/2);    
    curve(width, height, mouseY/2, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/1.5, 175, mouseY/1.5);    
    curve(width, height, mouseY/1.5, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX/1.25, 175, mouseY/1.25);    
    curve(width, height, mouseY/1.25, 0, 500, mouseY, 0, mouseY);
    stroke(mouseX, 175, mouseY);    
    curve(width, height, mouseY, 0, 500, mouseY, 0, mouseY);

    // right-originating lines
    stroke(mouseX/10, mouseY/10, 175);
    curve(width, 0, width, height/10, mouseX, 500, 0, mouseY);
    stroke(mouseX/9, mouseY/9, 175);
    curve(width, 0, width, height/9, mouseX, 500, 0, mouseY);
    stroke(mouseX/8, mouseY/8, 175);
    curve(width, 0, width, height/8, mouseX, 500, 0, mouseY);
    stroke(mouseX/7, mouseY/7, 175);
    curve(width, 0, width, height/7, mouseX, 500, 0, mouseY);
    stroke(mouseX/6, mouseY/6, 175);
    curve(width, 0, width, height/6, mouseX, 500, 0, mouseY);
    stroke(mouseX/5, mouseY/5, 175);
    curve(width, 0, width, height/5, mouseX, 500, 0, mouseY);
    stroke(mouseX/4, mouseY/4, 175);
    curve(width, 0, width, height/4, mouseX, 500, 0, mouseY);
    stroke(mouseX/3, mouseY/3, 175);
    curve(width, 0, width, height/3, mouseX, 500, 0, mouseY);
    stroke(mouseX/2, mouseY/2, 175);
    curve(width, 0, width, height/2, mouseX, 500, 0, mouseY);
    stroke(mouseX/1.5, mouseY/1.5, 175);
    curve(width, 0, width, height/1.5, mouseX, 500, 0, mouseY);
    stroke(mouseX/1.25, mouseY/1.25, 175);
    curve(width, 0, width, height/1.25, mouseX, 500, 0, mouseY);

    // left-originating lines
    stroke(175, mouseY/10, mouseX/10);
    curve(0, height, 0, height/10, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/9, mouseX/9);
    curve(0, height, 0, height/9, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/8, mouseX/8);
    curve(0, height, 0, height/8, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/7, mouseX/7);    
    curve(0, height, 0, height/7, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/6, mouseX/6);    
    curve(0, height, 0, height/6, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/5, mouseX/5);    
    curve(0, height, 0, height/5, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/4, mouseX/4);    
    curve(0, height, 0, height/4, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/3, mouseX/3);    
    curve(0, height, 0, height/3, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/2, mouseX/2);    
    curve(0, height, 0, height/2, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/1.5, mouseX/1.5);    
    curve(0, height, 0, height/1.5, width, mouseX, mouseY, mouseY);
    stroke(175, mouseY/1.25, mouseX/1.25);    
    curve(0, height, 0, height/1.25, width, mouseX, mouseY, mouseY);
}

Leave a Reply