Project 7

sketch
//Paul
//kengpul
//Section A
var x;
var y;
var circ = [];
// determines the line and size of the circle creating the circle w line inside
var drawingLine;
var lineDeg = 0;
var circleDeg = 0;
var colorStep = 0;
var colorStep2 = 0;

function setup() {
    createCanvas(480, 480);
    background(random(50,70),100,random(150,256));
}


function draw() {
    //creating perilin colors
    //cghanges size of the elements based on mouse y
    drawingLine = map(mouseY,0,height,20,height/5)
    //background(240,170,20);
    push();
    translate(width/2,height/2);
    rotate(radians(circleDeg));
    bigCirc();
    pop();
    circleDeg += map(5,0,width/2,0,drawingLine)*1.5;

    
    colorStep = colorStep += 0.01;
    colorStep2 = colorStep2 += 0.005;

}



//two functions under creates a line that spins 
//according to the center of the circle created in bigCirc(), this is done to replicate 
//the effect of an Astroid but with an interactive twist

function insideLine(){
    push();
    stroke(100,255,100);
    strokeWeight(1);
    //moves origin to center and top so the lines can rotate as it should
    translate(width/2-drawingLine,drawingLine/2+drawingLine*2);
    rotate(radians(lineDeg));
    line(0,0,0,drawingLine/2);
    strokeWeight(7);
    var pointCol = 255 * noise(colorStep2);
    stroke(pointCol,10,10);
    point(0,drawingLine*2);
    pop();
    //changes how "circular" the dots are printed 
    lineDeg += map(mouseX,0,width,0,5);
}

function bigCirc(){
    noFill();
    strokeWeight(1.5);

    //rgb value created with noise so each color doesnt vary too much circle to circle
    var r = 255 * noise(colorStep+5);
    var g = 255 * noise(colorStep+15);
    var b = 255 * noise(colorStep+20);
    stroke(r,g,b);
    circle(width/2-drawingLine,drawingLine/2+drawingLine*2,100);
    insideLine();
    //rotates the insideLine inside the circ
}
//when clicked , canvas resets with diff background so the program doesnt over crowd
function mousePressed(){
   background(random(50,70),100,random(150,256));
}


Leave a Reply