Sean Leo – Project 04 – String Art

This learning curve on this was step (pun intended) but once I realized I could copy and rotate the different parts it was smooth sailing.

sleo-project04

//Sean B. Leo
//sleo@andrew.cmu.edu
//Section C
//Project 04
var x1 = 0;
var y1 = 0;
var x2 = 0; 
var y2 = 350;
var x2step = 11; 
var y1step = 4;

function setup() {
  createCanvas(400, 300);
  background(0);
  strokeWeight(.6);
}

function draw() {
//first curve
stroke('blue');
for(var i=0; i<1; i++){
    line(x1, y1, x2, y2);
    y1+=y1step;
    x2+=x2step;
}
//blue curve translated, rotated and colored
push();
stroke('red');
translate(300, 0);
rotate(radians(90));
for(var i=0; i<1; i++){
    line(x1, y1, x2, y2);
    y1+=y1step;
    x2+=x2step;
}
pop();
//blue curve translated, rotated and colored 2
push();
stroke('green');
translate(400, 300);
rotate(radians(180));
for(var i=0; i<1; i++){
    line(x1, y1, x2, y2);
    y1+=y1step;
    x2+=x2step;
}
pop();
//blue curve translated, rotated and colored 3
push();
stroke('yellow');
translate(100, 300);
rotate(radians(270));
for(var i=0; i<1; i++){
line(x1, y1, x2, y2);
y1+=y1step;
x2+=x2step;
}
pop();
}
 
  

  
  

  
  

  

Leave a Reply