airsun-Interruptions

This project is tricky at first because I was not really sure about how to use the concept of noise as a primary function in accomplishing the assignment. It was interesting to really understand this concept throughout the project. And it is also interesting to see how some basic math concepts such as cosine and sine were also part of the knowledge we may need for the assignment. Moreover, the finishing product can be very artistic or rational based on individual choices, with all the lines bending and connecting each other like hairs or strictly similar to the original one.

//Clair(sijing) Sun
//sijings@andrew.cmu.edu


// Starter Code for "Embedded Iteration + Randomness"


var boolDoRefresh;
var n=0;
var randomD;
var gridSize = 9;
var degreeR;
var lineLength=17;
var xoff=0.5;
var poff=0.01;

function setup() {
    createCanvas(480, 480);
    boolDoRefresh = false;
    
}


function draw(){
    background(250);
    for (var x = gridSize; x <= width - gridSize; x += gridSize) {
            for (var y = gridSize; y <= height - gridSize; y += gridSize) {
                angleMode(DEGREES);
                degreeR=noise(x*xoff,y*xoff);
                degreeR=degreeR*180;
                randomD=noise(x*poff,y*poff);
                if (randomD < 0.65){
                    line(x, y, x+cos(degreeR)*lineLength, y+sin(degreeR)*lineLength);  
                }

        }
    }
}


 
function mousePressed() {
    noiseSeed();
    redraw();
}