Doodle.js — A Sprite Library for Canvas
I’ve been having a lot of fun with the HTML Canvas element and really look forward to utilizing the next-gen Javascript engines the browsers are starting to roll out.
However the drawing commands for it are a bit… basic. It can be difficult to work creatively when you have to constantly handle the “low level” details — that’s why I wanted to create a library that did it for me.
Doodle.js attempts to create a fun and easy way to interact with the Canvas that is lightweight, flexible, and functional. While it contains a few shape primitives it is not meant to be a full-fledged drawing api, rather a framework that allows you to build sprites and interact with them in an expressive way.
This is a 0.1 development release so please treat it accordingly. Bugs are sure to crop up so it’s best to test things out with your browser’s debug console open. I’ve been trying it on Chrome, Firefox 3.0.8, and IE 8 (using excanvas). Doodle.js is open source software and has been released under the MIT license, please feel free to poke around and submit code fixes :)
- doodle-0.1.1.js (41k)
- doodle-0.1.1.min.js (21k)
- github project
Here are a few demos I put together that you might want to take a look at before reading on.
- Spiral Pattern (drawing multiple times to canvas)
- Some Bouncy Balls (a little physics)
- Girl Comin’ to Get Ya (using images — no IE, sorry)
- Hearts a Flutter (custom shapes)
- Marbles in Space (simulating 3D)



