Ziningy1 – SectionC – Project 4 – String art

sketch

//Zining Ye 
//15104 lecture 1 recitation C
//ziningy1@andrew.cmu.edu 
//Project-04

var x=100;
var xstep=3; 

var y=1;
var ystep=3;

function setup() {
    createCanvas(400, 300);
    strokeWeight(1);
}

function draw() {
    background(0);
    angleMode(DEGREES);
    
    //the red twisted string curve 
    stroke(250,200,200);
    for (var i = 0; i < 400; i += 2) {
      
      line(3*i, height-2*i-y, 2*i, 1.5*i+20+y);
     
    }
    
    //the right and left green string curve 
    stroke(200,250,200);
    for (var i = 0; i<200; i += 2){
    
    line(x, 2*i,3*i,height/2+2*i+x);

    line(400-x,2*i,400-3*i,height/2+2*i+x);
    }
    
    //blue rotational string curve
    stroke(200,200,250);
    for (var i = 0; i<300; i += 2){
    line(x+i,300*sin(i),width-x-20-i,100*sin(i))
      
      
    }

    //adding the xstep and ystep will make the string start moving  
    //the conditonal makes the repeat between left and right, 

    y += ystep;
    if(y>300){
    y = -y
    
    }

    x += xstep;
    if(x>600){
    x= -x;
    
    } 



}
  













   


    







It is pretty abstract for me to create a string art image in my mind before coding it. I started by randomly test some of the combination of line positions, then I started to understand more intuitively how i would like to construct my art. I find adding the xstep, ystep very effective in making the string art in motion, which also create some sort of visual illusion that is pleasing to look at.

Leave a Reply