Project 04: Diagonal Sine Curve

sketch

//Name: Hari Vardhan Sampath
//Section: E
// Diagonal Sine Curves

var numLines = 45; //number of strings drawn

function setup() {
    createCanvas(400, 300);
    background(0);

    // red strings
    line(0, 0, 10, 150);
    line(50, 200, 150, 150);

    dx1 = (10-0)/numLines;
    dy1 = (150-0)/numLines;
    dx2 = (150-50)/numLines;
    dy2 = (150-200)/numLines;

    // yellow strings
    line(250, 100, 150, 150);
    line(400, 300, 390, 150);

    dx3 = (150-250)/numLines;
    dy3 = (150-100)/numLines;
    dx4 = (390-400)/numLines;
    dy4 = (150-300)/numLines;

    // purple strings
    line(150, 250, 150, 150);
    line(400, 300, 250, 290);

    dx5 = (150-150)/numLines;
    dy5 = (150-250)/numLines;
    dx6 = (250-400)/numLines;
    dy6 = (290-300)/numLines;

    // blue strings
    line(100, 10, 0, 0);
    line(150, 150, 150, 50);

    dx7 = (0-100)/numLines;
    dy7 = (0-10)/numLines;
    dx8 = (150-150)/numLines;
    dy8 = (50-150)/numLines;
}

function draw() {
    // red strings
    var x1 = 0;
    var y1 = 0;
    var x2 = 50;
    var y2 = 200;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(192, 57, 43);
        line(x1, y1, x2, y2);
        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;
    }
    // yellow strings
    var x3 = 250;
    var y3 = 100;
    var x4 = 400;
    var y4 = 300;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(244, 208, 63);
        line(x3, y3, x4, y4);
        x3 += dx3;
        y3 += dy3;
        x4 += dx4;
        y4 += dy4;
    }
    // purple strings
    var x5 = 150;
    var y5 = 250;
    var x6 = 400;
    var y6 = 300;
    for (var i = 0; i <= numLines; i += 1) {
        stroke('purple');
        line(x5, y5, x6, y6);
        x5 += dx5;
        y5 += dy5;
        x6 += dx6;
        y6 += dy6;
    }
    var x7 = 100;
    var y7 = 10;
    var x8 = 150;
    var y8 = 150;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(84, 153, 199);
        line(x7, y7, x8, y8);
        x7 += dx7;
        y7 += dy7;
        x8 += dx8;
        y8 += dy8;
    }

    noLoop();
}

In this project, I tried to explore the continuity of string art to form a sine curve, starting from the top left corner of the canvas until the diagonal bottom.

Project-04: String Art-Pineapple

Although it’s a bit abstract, but it is a pineapple. Everything is made by “string”.

sketchDownload
/* Jiayi Chen
   jiayiche    Section A */
function setup() {
    createCanvas(300, 400);
    background('yellow');
}

var numLines = 50;
var dx1;
var dy1;
var dx2;
var dy2;

function draw() {
    // percentize width and height
    var w= width/100;
    var h= height/100;

    //body of pinapple
    //diagonals(*w,*h,*w,*h,*w,*h,*w,*h) general formula
    diagonals(0*w,0*h,0*w,100*h,0*w,100*h,100*w,100*h); //left outside
    diagonals(100*w,0*h,100*w,100*h,100*w,100*h,0*w,100*h); //right outside
    diagonals(0*w,100*h,0*w,30*h,0*w,30*h,100*w,30*h); //left inside
    diagonals(100*w,100*h,100*w,30*h,100*w,30*h,0*w,30*h); //right inside
     //smooth the vertexes of pinnaple
    diagonals(10*w,80*h,50*w,95*h,50*w,95*h,90*w,80*h); //bottom
    diagonals(10*w,50*h,50*w,35*h,50*w,35*h,90*w,50*h); //top
    diagonals(40*w,30*h,10*w,60*h,10*w,60*h,40*w,90*h); //left
    diagonals(60*w,30*h,90*w,60*h,90*w,60*h,60*w,90*h); //right
    //Green Hair
    push();
    stroke('green');
    strokeWeight(2);
    diagonals3(15*w,20*h,30*w,45*h,70*w,45*h,80*w,20*h);//sides
    diagonals3(30*w,45*h,50*w,15*h,70*w,45*h,50*w,15*h);//middle
    diagonals3(30*w,45*h,50*w,15*h,50*w,15*h,70*w,45*h);//upper middle 
    pop();
    //background
    diagonals3(0*w,0*h,0*w,30*h,100*w,0*h,100*w,30*h);
    //texture
    diagonals2(25*w,60*h,40*w,58*h,40*w,58*h,50*w,45*h);//left
    diagonals2(25*w,60*h,40*w,58*h,40*w,58*h,50*w,75*h);
    diagonals2(75*w,60*h,60*w,58*h,60*w,58*h,50*w,45*h);//right
    diagonals2(75*w,60*h,60*w,58*h,60*w,58*h,50*w,75*h);
    diagonals2(50*w,75*h,30*w,80*h,30*w,80*h,35*w,85*h);//bottom left
    diagonals2(50*w,75*h,70*w,80*h,70*w,80*h,65*w,85*h);//bottom right
    noLoop();

}


function diagonals(x1,y1,x2,y2,x3,y3,x4,y4){ //diagonal/straight lines between 2 lines
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    dx1=(x2-x1)/numLines;
    dy1=(y2-y1)/numLines;
    dx3=(x3-x4)/numLines;
    dy3=(y3-y4)/numLines;
    for (var i = 0; i <= numLines; i += 1) {
        line(x1,y1,x3,y3);
        x1 += dx1;
        y1 += dy1;
        x3 -= dx3;
        y3 -= dy3; 
    }
}

function diagonals2(x1,y1,x2,y2,x3,y3,x4,y4){ //less lines
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    numLines=20;
    dx1=(x2-x1)/numLines;
    dy1=(y2-y1)/numLines;
    dx3=(x3-x4)/numLines;
    dy3=(y3-y4)/numLines;
    for (var i = 0; i <= numLines; i += 1) {
        line(x1,y1,x3,y3);
        x1 += dx1;
        y1 += dy1;
        x3 -= dx3;
        y3 -= dy3; 
    }
}

function diagonals3(x1,y1,x2,y2,x3,y3,x4,y4){ //less lines second version
    line(x1,y1,x2,y2);
    line(x3,y3,x4,y4);
    numLines=30;
    dx1=(x2-x1)/numLines;
    dy1=(y2-y1)/numLines;
    dx3=(x3-x4)/numLines;
    dy3=(y3-y4)/numLines;
    for (var i = 0; i <= numLines; i += 1) {
        line(x1,y1,x3,y3);
        x1 += dx1;
        y1 += dy1;
        x3 -= dx3;
        y3 -= dy3; 
    }
}

Project-04: String Art

sketchDownload
var idx1;
var idx2;
var idy1;
var idy2;
var iNumLines=60;

var ox;
var oy;
var ox2;
var oy2;



function setup() {
    createCanvas(400, 300);
    background(0);
    idx1=100/iNumLines;
    idx2=200/iNumLines;
    idy1=100/iNumLines;
    idy2=200/iNumLines;


    r=70;
    r2=0.3;

    ox=width/2;
    oy=height/2;
    ox2=width;
    oy2=height;

}

function draw() {
    fill(200,0,0)
    
    //lightening
    var ix1=150;
    var ix2=300;
    var iy1=130;
    var iy2=80;
    strokeWeight(1);
    for (var i=0;i<=iNumLines;i+=1){
        stroke(255,20,147); //deep pink
        line(ix1+=idx1,iy1-=idy1,ix2-=idx2,iy2+=idy2);
    }
    noLoop();

    //vertical hole
    //loop over 2pi and the origin circulates.
    for (var t=0;t<=360;t+=4){
        strokeWeight(2.5);
        stroke(255,250,205); //lemon
        line(-30+ox+ox2*r2*Math.cos(radians(t)), 170+oy2*r2*Math.sin(radians(t))-5,
            -30+ox+ox2*r2*Math.cos(radians(t)),150+oy2*r2*Math.sin(radians(t))+5);
    }

    noLoop();
    //horizontal hole
    //loop over 2pi and the origin circulates.
    for (var t=0;t<=360;t+=4){
        stroke(0,206,209); // turquoise
        line(30+ox+5+ox2*r2*Math.cos(radians(t))-5, 170+oy2*r2*Math.sin(radians(t)),
            30+ox+5+ox2*r2*Math.cos(radians(t))+5,150+oy2*r2*Math.sin(radians(t)));
    }

    noLoop();

   
   //middle circle
    strokeWeight(1);
    //loop over 2pi
    for (var theta=0;theta<=360;theta+=10){
        //change origin 10 times
        for (var change=0; change<=10;change+=10){
            stroke(255);
            line(ox+change+r*Math.cos(radians(theta)),oy+r*Math.sin(radians(theta)),
                ox+change-r*Math.cos(radians(theta)),oy-r*Math.sin(radians(theta)));
        }
    }
    noLoop();
    
}

Project 4: String Art

Good luck four leaf clover with abstract land and sky

sketch
// Ana Furtado 
// Section E
// Project 4 -- String Art

//Q1
var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 40;
//Q2
var bx1;
var by1;
var bx2;
var by2;
//Q3
var ax1;
var ay1;
var ax2;
var ay2;
//Q4
var cx1;
var cy1;
var cx2;
var cy2;
//Right
var ex1;
var ey1;
var ex2;
var ey2;
//Left
var fx1;
var fy1;
var fx2;
var fy2;

function setup() {
    createCanvas(400, 300);
    background(255); // white background with abstract land and sky
    strokeWeight(2);
    

    //Sky
    //Q1 lines
    stroke(179,243,255); //light blue
    line(0, 50, 350, 0);
    line(0, 250, 50, 0);
    dx1 = (350-0)/numLines;
    dy1 = (0-50)/numLines;
    dx2 = (50-0)/numLines;
    dy2 = (0-250)/numLines;

    //Q2 lines
    stroke(179,243,255); //light blue
    line(350, 0, 400, 250);
    line(50, 0, 400, 50);
    bx1 = (400-350)/numLines;
    by1 = (250-0)/numLines
    bx2 = (400-50)/numLines
    by2 = (50-0)/numLines
    
    //Land
    //Q3 lines
    stroke(192,255,135); //light green
    line(350, 300, 400, 50);
    line(50, 300, 400, 250);
    ax1 = (400-350)/numLines;
    ay1 = (50-300)/numLines
    ax2 = (400-50)/numLines
    ay2 = (250-300)/numLines

    //Q4 lines
    stroke(192,255,135); //light green
    line(350, 300, 0, 250); 
    line(50, 300, 0, 50);
    cx1 = (0-350)/numLines;
    cy1 = (250-300)/numLines
    cx2 = (0-50)/numLines
    cy2 = (50-300)/numLines


    //Center (4 leaf clover)
    //Right
    strokeWeight(1.25);
    stroke(92,255,92); //green
    line(210, 75, 190, 225); 
    line(275, 140, 125, 160); 
    ex1 = (190-210)/numLines;
    ey1 = (225-75)/numLines
    ex2 = (125-275)/numLines
    ey2 = (160-140)/numLines

    //Left
    stroke(92,255,92); //green
    line(210, 225, 190, 75); 
    line(275, 160, 125, 140); 
    fx1 = (190-210)/numLines;
    fy1 = (75-225)/numLines
    fx2 = (125-275)/numLines
    fy2 = (140-160)/numLines

}

function draw() {
    //Sky
    //Q1 -- upper left sky
    strokeWeight(1);
    var x1 = 0;
    var y1 = 50;
    var x2 = 0;
    var y2 = 250;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(179,243,255); //light blue
        line(x1, y1, x2, y2);
        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;
    }

    //Q2 -- upper right sky
    var x1 = 350;
    var y1 = 0;
    var x2 = 50;
    var y2 = 0;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(179,243,255); //light blue
        line(x1, y1, x2, y2);
        x1 += bx1;
        y1 += by1;
        x2 += bx2;
        y2 += by2;
    }

    //Land
    // Q3 -- bottom right land
    var x1 = 350;
    var y1 = 300;
    var x2 = 50;
    var y2 = 300;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(192,255,135); //light green
        line(x1, y1, x2, y2);
        x1 += ax1;
        y1 += ay1;
        x2 += ax2;
        y2 += ay2;
    }

    //Q4 -- bottom left land
    var x1 = 350;
    var y1 = 300;
    var x2 = 50;
    var y2 = 300;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(192,255,135); //light green
        line(x1, y1, x2, y2);
        x1 += cx1;
        y1 += cy1;
        x2 += cx2;
        y2 += cy2;
    }

    //Green Center (4 leaf clover)
    //Right
    strokeWeight(1.25);
    var x1 = 210;
    var y1 = 75;
    var x2 = 275;
    var y2 = 140;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(92,255,92); //green
        line(x1, y1, x2, y2);
        x1 += ex1;
        y1 += ey1;
        x2 += ex2;
        y2 += ey2;
    }

    //Left
    var x1 = 210;
    var y1 = 225;
    var x2 = 275;
    var y2 = 160;
    for (var i = 0; i <= numLines; i += 1) {
        stroke(92,255,92); //green
        line(x1, y1, x2, y2);
        x1 += fx1;
        y1 += fy1;
        x2 += fx2;
        y2 += fy2;
    }

    //Stem
    strokeWeight(3);
    stroke(92,255,92); //green
    line(200,150, 200, 270)

    noLoop();
    

}

The most challenging part of this project was keeping track of which variables were being used and if the coordinates were right.

Project 04: Illuminati out of the Pyramid!

sketchDownload
// Ilia Urgen
// Section B

var numLines = 60;

function setup() {
    createCanvas (400,300); 
    
    color_1 = color (135,206,245);
    color_2 = color (253,217,181);

    // ombre 
    for (var y = 0; y < height; y++ ) {
        n = map (y,0, height, 0, 1);
        var color_3 = lerpColor (color_1, color_2, n);
        stroke (color_3);
        line (0, y, width, y);
    }

    stroke (0);

    // canvas border lines
    line (1,1,1,299);
    line (1,1,399,1);
    line (1,299,399,299);
    line (399,1,399,299);
} 

function draw() {
    
    for (var i = 0; i <= numLines; i += 1) {

        var x1 = 0;
        var y1 = i * width / numLines;
        var x2 = i * height / numLines;
        var y2 = 300;

        // lower eye curve
        strokeWeight(0.5);
        line (x1, y1, x2, y2);
        
        // upper eye curve and pyramid side
        line (x2, 0, 400, y1);

        // lower eye lines
        line (y1, x2 * 1.05, x1, y1 - 20);

        // pyramid face
        line (y2, x2, x1 - 2.1, y2 + 200);

        // eye line
        strokeWeight(2);
        line (0,0,382,303);
        
    }

    //illuminati eye
    push();

    translate (185, 152);
    rotate(radians(38));
    fill (0);
    ellipse (0,0,180,80);
    fill (255);
    ellipse (0,0,80);
    fill (0);
    ellipse (0,0,20);

    pop();

noLoop();
}

project 4

sketch
//Keng Pu (Paul) Li
//section A 
//9/24/22

var numLines = 50;
var dx1;
var dy1;
var dx2;
var dy2;
var dx3;
var dy3;
var dx4;
var dy4;
var dx5;
var dy5;
var dx6;
var dy6;

function setup() {
    createCanvas(300,400);
    background(220,50,100);
//triangle
    dx1 = 5;
    dy1 = 5;
    dx2 = 10;
    dy2 = 10;
//most left
    dx3 = 5;
    dy3 = 1;
    dx4 = 5;
    dy4 = 5;
//blue
    dx5 = 7;
    dy5 = 1;
    dx6 = 5;
    dy6 = 5;
//dark blue line
    dx7 = 5;
    dy7 = 1;
    dx8 = 15;
    dy8 = 15;

//very dark
    dx9 = 10;
    dy9 = 7;
    dx10 = 20;
    dy10 = 5;
}

function draw() {
    background(220,50,100);
//most left 
    x3 = 0;
    y3 = width/2+100;
    x4 = width/2;
    y4 = width/2+100;
    for(var i = 0; i<40; i++){
        strokeWeight(2);
        stroke(200,90,180);
        line(x3,y3,x4,y4);
        x3 += dx3;
        y3 += dy3;
        x4 -= dx4;
        y4 += dy4;
    }
    //triangle
    x1 = width/2;
    y1 = width/2+100;
    x2 = width/2;
    y2 = width/2+100;
    for(var i = 0; i<100; i++){
        strokeWeight(3);
        stroke(0,20,20,70);
        line(x1,y1,x2,y2);
        x1 += dx1;
        y1 += dy1;
        x2 -= dx2;
        y2 += dy2;
    }
 //dark blue line
    x7 = width-170;
    y7 = 50;
    x8 = width/2+70;
    y8 = width;
    for(var i = 0; i<100; i++){
        strokeWeight(1);
        stroke(50,10,190);
        line(x7,y7,x8,y8);
        x7 += dx7;
        y7 += dy7;
        x8 -= dx8;
        y8 += dy8;
    }

//blue line
    x5 = 0;
    y5 = width/2;
    x6 = width/2+50;
    y6 = width;
    for(var i = 0; i<90; i++){
        strokeWeight(0.5);
        stroke(110,110,255);
        line(x5,y5,x6,y6);
        x5 += dx5;
        y5 += dy5;
        x6 -= dx6;
        y6 += dy6;
    }


    //very dark lines
    x9 = width/2+50;
    y9 = -100;
    x10 = width;
    y10 = height;
    for(var i = 0; i<100; i++){
        strokeWeight(0.5);
        stroke(50,10,90);
        line(x9,y9,x10,y10);
        x9 += dx9;
        y9 += dy9;
        x10 -= dx10;
        y10 += dy10;
    }
}

Project 4

this is my project 4

sketch
var dx1;
var dy1;
var dx2;
var dy2;
var distance = 5
var numLines = 35;

function setup() {
    createCanvas(400, 300);
    background(0);
    line(250, 0, 25, 25); //top-left
    line(25, 25, 0, 250);
    
    dx1 = -225/numLines;
    dy1 = 25/numLines;
    dx2 = -25/numLines;
    dy2 = 225/numLines;

    line(150, 300, 375, 275);  // bottom right
    line(375, 275, 400, 50);

    bx1 = 225/numLines;
    by1 = -25/numLines;
    bx2 = 25/numLines;
    by2 = -225/numLines;

}

function draw() {

    //top left part
    var x1 = 250;
    var y1 = 0;
    var x2 = 25;
    var y2 = 25;

    stroke(0, 50, 233);

    for (var i = 0; i <= numLines; i += 1) {
        line(x1, y1, x2, y2);
        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;
    }  

    //bottom right
    var a1 = 150;
    var b1 = 300;
    var a2 = 375;
    var b2 = 275;
    for (var i = 0; i <= numLines; i += 1) {
        line(a1, b1, a2, b2);
        a1 += bx1;
        b1 += by1;
        a2 += bx2;
        b2 += by2;
    }

    //circular shape
    push();
    translate(width/2, height/2);
    var x = 200
    var y = 100;

    //pink
    for(y = 10; y <= 500; y += 3) {
        rotate(radians(175));
        strokeWeight(1)
        stroke(244, 82, 255);
        line(x, y, 10, y)
    }
    //blue
    for(y = 40; y <= 400; y+=0.5) {
        rotate(radians(35));
        strokeWeight(0.8)
        stroke(81, 211, 255, 70);
        line(150, y, x+distance, y+distance)
        distance -= 5;
    }

    pop()

    noLoop();
}

Project-04: String Art

Shirley Du P4

sketch

Examples:

//Xinyi Du 
//15104 Section B

var dx;
var dy;
var dx2;
var dy2;
var numInterval1 = 12; //number of intervals
var numInterval2 = 10; //number of intervals

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

function draw() {
    background(0);

    //the first series of strings
    stroke(189, 252, 83);
    string1(mouseX, mouseY);
    stroke(100);
    string2(mouseX, mouseY);

    push();
    translate(400, 0); //translate the orgin to top right corner
    rotate(radians(90)); //rotate to get the second series of strings in another color
    stroke(47, 109, 246);
    string1(mouseX, mouseY);
    stroke(100);
    string2(mouseX, mouseY);
    pop();

    push();
    translate(400, 400); //translate the orgin to bottom right corner
    rotate(radians(180)); //rotate to get the third series of strings in another color
    stroke(106, 214, 129);
    string1(mouseX, mouseY);
    stroke(100);
    string2(mouseX, mouseY);
    pop();

    push();
    translate(0, 400); //translate the orgin to bottom left corner
    rotate(radians(270)); //rotate to get the fourth series of strings in another color
    stroke(91, 196, 218);
    string1(mouseX, mouseY);
    stroke(100);
    string2(mouseX, mouseY);
    pop();
}

//draw the small and grey central strings that follows the mouse
function string2(x, y) {
    var dx2 = (dist(x, y, width/2, y))/numInterval1; //strings horizontal interval
    var dy2 = (dist(x, y, x, height/2))/numInterval1; //strings vertical interval
    for (var i = 0; i < numInterval1; i += 1){ //use for loop to repeat the drawing process
        line(width/2, y+dx2*i, width/2+dx2*i+dx2, height/2);
        line(width/2, y, width/2, height/2);
        line(width/2, height/2, x, height/2);
    }
}

function string1(x, y) {
    //draw the bigger strings at one side of the canvas
    var dx = (height/2)/numInterval1; //strings horizontal interval
    var dy = (width/2)/numInterval1; //strings vertical interval
    for (var i = 0; i <= numInterval1; i += 1){ //use for loop to repeat the drawing process
        line(0, dy*i-dy, dx*i, width/2); 
        line(0, height/2, width/2, height/2)
        line(0, width/2+dy*i+dy, width/2-dx*i, height/2);
        
    }

    //draw the smaller strings that follows the mouse
    var dx2 = (dist(x, y, width/2, y))/numInterval2;
    var dy2 = (dist(x, y, x, height/2))/numInterval2;
    for (var i = 0; i < numInterval2; i += 1){ //use for loop to repeat the drawing process
        line(width/2+dx2*i, y, x, y+dx2*i+dx2);
        line(width/2, y, x, y);
        line(x, y, x, height/2);
    }

}



Project-04: String Art-Section B

All Seeing Eye.

sketch
/*
* Evan Stuhlfire
* estuhlfi@andrew.cmu.edu
* Section B
*
* Project-04: String Art
* This program uses geometric shapes to create
* string art.
*/

function setup() {
    createCanvas(400, 300);
    background(73, 80, 87); //davys grey from coolors.com

}

function draw() {   
    // draw the string lines for the frame in light blue
    stringLeftLower(204, 255, 255, 55);
    stringLeftUpper(204, 255, 255, 55);
    stringRightUpper(204, 255, 255, 55);
    stringRightLower(204, 255, 255, 55);

    // move origin of canvas to center
    translate(width/2, height/2);

    // draw the circle design with light blue
    stringCircle(204, 255, 255); 
    noLoop();
}

/* draw the string pattern at the lower left */
function stringLeftLower(r, g, b, t) {
    var numLines = 40;
    var x1 = 0; // start at top right
    var y1 = 0; // top right
    var y2 = height;
    var x2 = xInc = (width/numLines);
    var yInc = (height/numLines);

    stroke(r, g, b, t);
    // iterate over each line to draw
    for (index = 0; index < numLines; index ++) {
        line(x1, y1, x2, y2);
        y1 += yInc;
        x2 += xInc;
    }
}

/* draw the string pattern at the upper left */
function stringLeftUpper(r, g, b, t) {
    // set vars to start at lower left and draw up
    var numLines = 40;
    var x1 = 0;
    var y1 = height; // lower left
    var y2 = 0;
    var x2 = xInc = width/numLines;
    var yInc = height/ numLines;

    stroke(r, g, b, t);
    // iterate over each line to draw
    for (index = 0; index < numLines; index ++) {
        line(x1, y1, x2, y2);
        y1 -= yInc; // move up the canvas
        x2 += xInc; // move across the canvas
    }
}

/* draw the string pattern at the upper right */
function stringRightUpper(r, g, b, t) {
    var numLines = 40;
    var x1 = xInc = width/numLines;
    var x2 = width;
    var y1 = 0;
    var y2 = 0;
    var yInc = height/ numLines;

    stroke(r, g, b, t);
    // iterate over each line to draw
    for (index = 0; index < numLines; index ++) {
        line(x1, y1, x2, y2);
        y2 += yInc; // move down the canvas
        x1 += xInc; // move right across the canvas
    }
}

/* draw the string pattern at the lower right */
function stringRightLower(r, g, b, t) {
    // set variable
    var numLines = 40;
    var x1 = width; // right side
    var x2 = 0;
    var xInc = width/numLines;;
    var yInc = height/numLines;
    var y1 = height - yInc; // bottom right
    var y2 = height;

    stroke(r, g, b, t); // set color and transparency
    // iterate over each line to draw
    for (index = 0; index < numLines; index ++) {
        line(x1, y1, x2, y2); 
        y1 -= yInc; // move up the canvas
        x2 += xInc; // move right across the canvase
    }
}

/* draw the center string circle */
function stringCircle(r, g, b) {
    // 36 spokes on the circle design
    var circlePoints = 36;
    var angle = 0;
    var rotDeg = 0;

    // iterate over each spoke
    for (index = 0; index < circlePoints; index++) {
        // save settings
        push();

        // map the angle to the perimeter of the circle
        angle = map(index, 0, circlePoints, 0, TWO_PI);

        // convert angle to x y coordinates
        var radius = 90;
        var circleX = radius * cos(angle);
        var circleY = radius * sin(angle);

        // move origin to the starting point of the circle
        translate(circleX, circleY);

        // rotate each spoke to the origin
        rotate(radians(rotDeg));

        // variables for drawing string design
        var circleX2 = -radius * 2;
        var circleY2 = 0;
        var smallCircleDiam = 10;
        var offset = 15;

        // draw small circles at end of spokes
        stroke(r, g, b, 255);
        circle(0, 0, smallCircleDiam * .2);
        noFill();
        circle(0, 0, smallCircleDiam); // outline

        // set stroke color and decrease transparency to
        // see more detail.
        stroke(r, g, b, 125); 

        // draw three lines from each perimeter point to
        // create spokes
        line(0, 0, circleX2, circleY2);
        line(0, 0, circleX2, circleY2 + offset);
        line(0, 0, circleX2, circleY2 -offset);

        // extend lines off of spokes
        stroke(r, g, b, 50);
        line(0, 0, offset * 8, circleY2);
        line(0, 0, offset * 8, circleY2 + offset);
        line(0, 0, offset * 8, circleY2 -offset);

        // call function to draw the background circles with
        // transparancey
        backgroundCircles(index, offset, r, g, b, 80);

        pop(); // restore settings 
        rotDeg += 10; // rotate 10 degrees 36/360
    }
}

/* draw the background circles with design */
function backgroundCircles(index, offset, r, g, b, t) {
    // save settings
    push();
    stroke(r, g, b, t); // light blue with transparency
    // rest origin, space circles out
    translate(25, 0);

    // draw small inner circle on even spoke
    if (index % 2 == 0) {           
        circle(0, 0, 20);
        circle(110, 0, 70);
    } else {
        var diam = offset * 4; // set diameter
        // draw bigger circle on odd spoke
        circle(offset * 3, 0, diam);

        // string design of four circles inside each 
        // bigger circle
        var shiftValue = 10;
        circle(offset * 3, -shiftValue, diam/2);
        circle(offset * 3, shiftValue, diam/2);
        circle(offset * 3 + shiftValue, 0, diam/2);
        circle(offset * 3 - shiftValue, 0, diam/2);
    }
    pop();// restores settings
}