Project Teeter

I recently was contacted by the Developer Relations team at Leap Motion and had a great chat with them. Toward that end, I'm starting to work on a simple game in Processing. All I've done so far is put in some of the basic framework and a simple interaction. Up next is to add game physics, bring in some other objects and integrate the Leap Motion detector. I'd love to put a working processing sketch on the site for you to play with, but I'm unable to get Squarespace to cooperate with Processing.js. Might move to a different host in the future, but for now, here's a video and code below: 

Processing code:

float angle = 0.0;
float rotSpeed = 0.001;
float easing = 0.00007;
int dimX = 640;
int dimY = 360;

void setup() {
size(dimX, dimY);
smooth();
}

void draw() {
background(100);
noStroke();
translate(width/2, 0.8 * height);

// Pivot
fill(255);
float triSide = 50;
float triH = triSide*sqrt(3)/2;
triangle(0, 0, -triSide/2, triH, triSide/2, triH );

// Beam
pushMatrix();
rectMode(CENTER);
int rectW = 400;
int rectH = 40;
rotate(angle);
rect(0, -rectH / 2, rectW, rectH);
popMatrix();

if (abs(angle) < asin(2*triH/rectW)) {
//Move towards mouseX with easing
float targetX = mouseX;
angle += (mouseX - width/2) * easing;
} else {
//Hits ground
angle += 0;
stroke(255, 0, 0);
strokeWeight(3);
line(-width/2, triSide*sqrt(3)/2, width/2, triSide*sqrt(3)/2);
if (mousePressed) {
angle = 0;
}
}
}