You might want to check this out: LeapTrainer.js. It's a JavaScript implementation of a something similar to what you are thinking about. It's over a year old by now, but it should get you started. (If you use any of the code, just make sure to read the license for it first.)
Other than that, you pretty much have to build a system from scratch since the Leap API does not support custom gestures.