Reverse Engineering 6a
2014-09-24 23:36:02 +0000
var width = window.innerWidth;
var height = $('body').height() - 3;
var halfWidth = width / 2;
var halfHeight = height / 2;

function drawerSketch(processing) {
  // set size
  processing.size(width, height);

  var starPoints = 50;
var pointLength = height / 3;

function drawStar() {
  var color = processing.random(255);
  processing.stroke(color);
  processing.strokeWeight(4);
  processing.background(processing.map(color, 0, 255, 255, 0));
  for (var i = 0; i <= starPoints; i++) {
    var theta = i * (360 / starPoints);
    console.log(processing.radians(theta));
    processing.pushMatrix();
    processing.translate(halfWidth, halfHeight);
    processing.rotate(processing.radians(theta));
    processing.line(0,0,pointLength,0);
    processing.popMatrix();
  }
}

processing.setup = function() {
  drawStar();
};

processing.draw = function() {
};

processing.keyPressed = function() {
  console.log(processing.key);
  drawStar();
};

processing.mousePressed = function() {

};

processing.mouseReleased = function() {

};


}
// attach the sketch function to the canvas
var processingInstance = new Processing(document.getElementById('sketch'), drawerSketch);