Project 4 – String Art

sketch

var x1;
var x2;
var y1;
var y2;
var x1ss;
var y1ss;
var x3;
var x4;
var y3;
var y4;
var y2ss;
var x5;
var y5;

function setup() {
  createCanvas(300, 400);
  background (0);
  x1 = 0;
  y1 = 0;
  x1ss = 10;
  y1ss = 50;
  x2 = x1 + x1ss;
  y2 = y1 + y1ss;
  x3 = 0;
  y3 = 400;
  x1ss = 10;
  y1ss = 50;
  x4 = x1 + x1ss;
  y4 = y1 + y1ss;
}
function draw() {
  noFill();
  stroke(255);
  strokeWeight(1);
  line(x1, y1, x2, y2);
  x1ss = x1ss * 1.35;
  y1ss = y1ss * 1.3;
  x2 = x1 + x1ss;
  y2 = y1 + y1ss;
  y2ss = -y1ss;

  stroke("red");
  strokeWeight(1);
  line(x3, y3, x4, y4);
  x4 = x3 + x1ss;
  y4 = y3 + y2ss;

  stroke("pink");
  strokeWeight(1);
  line(x2 - x1, y2 - y1, y2- y1, x2 - x1);

  stroke("grey")
  line(300 - x2, 400 - x2, x4 / 3, y4 / 3);
}

Leave a Reply