Kinetic.js
KineticJS is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling high performance event detection for desktop and mobile applications.
The KineticJS library was created by Eric Rowell, and is distributed freely on GitHub, or his website.
How IT Works
Kinetic stages are made up of user defined layers. Each layer has two canvas contexts, a scene context and a buffer context. The scene context is what you can see, and the buffer context is a special hidden context that's used for high performance event detection. Each layer can contain shapes and groups of shapes. The stage, layers, groups, and shapes are virtual nodes, similar to DOM nodes in an HTML page.
All nodes can be styled and transformed. Although KineticJS has prebuilt shapes available, such as rectangles, circles, images, sprites, text, lines, polygons, regular polygons, paths, stars, etc., you can also create custom shapes by instantiating the Shape class and creating a draw function.
Once you have a stage set up with layers and shapes, you can bind event listeners, transition nodes, run animations, apply filters, and much more.
Features
- Object Oriented API
- Node nesting and event bubbling
- High performance event detection via color mapping hash
- Layering support
- Node caching to improve draw performance
- Nodes can be converted into data URLs, image data, or image objects
- Animation support
- Transition support
- Drag and drop with configurable constraints and bounds
- Filters
- Ready to use shapes including rectangles, circles, images, text, lines, polygons, SVG paths, and more
- Custom shapes
- Event driven architecture which enables developers to subscribe to attr change events, layer draw events, and more
- Serialization & de-serialization
- Selector support e.g. stage.get('#foo') and layer.get('.bar');
- Desktop and mobile events