Aaron Lee-Project-07

sketch

/*
Aaron Lee
//Section C
//sangwon2@andrew.cmu.edu
Project-07-Composistion with Curves
*/
         
function setup() {
  createCanvas(400,400);
  frameRate(10);
}

function draw() {
  background(0);

  for(var i=0; i<100; i++) {   

    stroke(random(255), random(255), random(255));
    noFill();       
    Hypo(i*30, mouseX);   
  }
}
//hypotrochoid
//http://mathworld.wolfram.com/Hypotrochoid.html
function Hypo(a, mouseY) {
  var x;
  var y; 

  var a;                  
  var b=a/40;            
  var h = constrain(mouseY/10, 0, a);   
  var ph = mouseX/50; 
  push();                
  translate(width/2, height/2);
  beginShape();
  for(var i=0; i<100; i++) {
    var t = map(i, 0, 100, 0, TWO_PI);
    x=(a-b)*cos(t) + h*cos(ph+t*(a-b)/b);
    y=(a-b)*sin(t) - h*sin(ph+t*(a-b)/b);
    vertex(x, y); 
  }
  endShape(CLOSE);
  pop();
}

In this project I was working mainly with Hypotrochoids in loop. I wanted to make series of psychedelic experience as the mouse scrolls.

Leave a Reply