Project 04-String Art

These are my abstract butterflies.

sketch
// Natalie Koch
// nataliek
// Section A

// Abstract Butterflies

var numLines = 400;
var c1 = ['pink', 'blue' , 'purple'] //color 1
var c2 = ['blue', 'red', 'yellow'] //color 2
var c3 = ['pink', 'green' , 'orange'] //color 3
var dx1 = 10*(150-50)/numLines;
var dy1 = 10*(300-50)/numLines;
var dx2 = 10*(350-300)/numLines;
var dy2 = 10*(100-300)/numLines;
function setup() {
    createCanvas(400, 400);
    background(0);

}

function draw() {
    function a (x1, y1, x2, y2,dx1, dy1, dx2, dy2, colorList) {
        for (var i = 0; i <= numLines; i += 1) {
            stroke(random(colorList))
            line(x1, y1, x2, y2);
            x1 += cos(i)*dx1*15;
            y1 += sin(i)*dy1*15;
            x2 += cos(i)*dx2*20;
            y2 += sin(i)*dy2*20;
            
        }
    }
    a(50,50,300,300,dx1,dy1,dx2,dy2, c1)
    a(50,200,200,375,dx1,dy1,dx2,dy2, c2)
    a(150,25,300,200,dx1,dy1,dx2,dy2, c3)

    noLoop()
}

Leave a Reply