I love creating tools where user have ability to drop an image from his local drive to the browser. However starting boilerplate from scratch every time quickly becomes a boring routine.
This is why I introduced .onDropImage method to CanvasQuery. Now you can setup an image drop tool with canvas in just a few lines of code
cq()
.onDropImage(function(image) {
/* do whatever you like with the image */
});
Yes. This is really THAT simple.
Check the live example Get CanvasQuery
Micro-framework in CanvasQuery
For those unfamiliar this is not the only feature of CQMF – you can also bind mouse, keyboard and a loop if you need
cq()
.onDropImage(function(image) { ... })
.onMouseMove(function(x, y) { doSomethingWithMouse(); })
.onKeyDown(function(key) {
if(key == "enter") alert("Hey Return!");
})
And this is how to apply the game loop
cq()
/* this one uses setInterval */
.onStep(function(delta) { ... })
/* and this takes advantage on requestAnimationFrame */
.onRender(function(delta) { ... })



