reverse engineering 1
2014-08-27 19:15:51 +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);
processing.setup = function() {
processing.background(255);
processing.fill(255, 0, 0);
processing.stroke(0);
};
processing.mousePressed = function() {
if (processing.mouseX < halfWidth) {
processing.ellipse(processing.mouseX, processing.mouseY, 50, 50);
} else {
processing.rect(processing.mouseX, processing.mouseY, 50, 50);
}
};
processing.keyPressed = function() {
processing.background(0);
};
}
// attach the sketch function to the canvas
var processingInstance = new Processing(document.getElementById('sketch'), drawerSketch);