Project 04: String Art

sketchDownload
//Carson Michaelis
//Section C
var yy = -25
var xx = -25

function setup() {
    createCanvas(400, 300);
    background(220);
}

function draw() {
    var y = 300
    var y3 = 0
//make sure there's no trails
    background(220);
//black ellipse in middle
    push();
    noStroke();
    fill(0);
    ellipse(200,150,280,225);
    pop();

    noFill();
    strokeWeight(.5);
//moving points in middle
    if (yy == -25 & xx < 25) {
      xx += 1
    } else if (xx == 25 && yy < 25) {
      yy += 1
    } else if (yy == 25 && xx > -25) {
      xx -= 1
    } else if (xx == -25 && yy > -25) {
      yy -= 1
    }
//generating lines from side to side
      for (let x = 0; x <= 400; x += 400/24) {
          line(x,0,0,y);
          line(x,0,400,300-y);
          line(x,300,0,300-y);
          line(x,300,400,y)
          y -= 300/24;
      }

      push();
      stroke(255);
//lines connecting middle portion to outer lines
      line(200,25,365,150);
      line(200,25,35,150);
      line(200,275,35,150);
      line(200,275,365,150)

      print(xx.toString());
      print(yy.toString());
//generating moving lines inside ellipse
      for (let x = 0; x <= 20; x += 1) {
          line((x*(33/4))+200,y3+25,200+xx,150+yy);
          line((x*(-33/4))+200,y3+25,200-xx,150+yy);
          line((x*(33/4))+200,300-(y3+25),200+xx,150-yy);
          line((x*(-33/4))+200,300-(y3+25),200-xx,150-yy);
          y3 += (25/4);
        }
      pop();
}

For this project I wanted a portion of the lines to move, as well as to create black and white lines that contrast with each other. Here they explore the idea of an open versus occupied middle, as well as the way overlapping lines interact.

Leave a Reply