Alice Cai Project 4

sketch

//Alice Cai
//alcai
//project#4
//Section E

//global variables
var x;
var y;
var aY;
var aX;

function setup() {
    createCanvas(480, 240);
    strokeWeight(3);
}

function draw() {
//background
    background(200) ;
    strokeWeight(1);

//defining variables 
    aX = mouseX
    aY = mouseY
    x = x * aY
    y = y * aX

//orange lines

    stroke('orange');
    for (var y = 100; y < 10000; y += 5) {
    line(y, aY, width - aX, y);
    line(y, aY, height - aY, y);

    }
//pink lines
    stroke('pink');
    for (var x = 100; x < height; x += 5) {
    line(x, aX, x, aY);
    line(aY, x, x, aX);

    }
//blue lines
    stroke('blue');
    for (var y = 100; y < width; y += 5) {
    line(aX, x, y, aY);
    line(aX, x - y - x, y, aY);

    }
//color changing
    stroke(mouseX,mouseY,mouseY);
    for (var y = 100; y < width; y += 5) {
    line(aX, x - aX, x, aY);
    line(aX, y - aX, y, aY);
    line(aY, y - aX, y, aX);
    }

}

This is my string art. At first, all my curves looked the same because I only used an i variable. After I added more the drawing became more dynamic. Each curve is drawn by a series of lines that are slightly shifted using a for loop and small increments that tilt the line and form a curve.

Leave a Reply