Piqnt
Stage.js

Stage.js is a lightweight and high performance 2D HTML5/JavaScript library for cross-platform game development. It is an open-source Canvas library inspired by DOM with a new concept called pinning introduced instead of styling.

Examples


Loading...

Why

Canvas is the graphic component of HTML5 game development, but it only has a drawing API, there is no data model like DOM to compose your application; you have to manually draw your application and manage rendering cycles to play it. Moreover, mouse events are only available at entire Canvas level and they also need to be processed manually.

Stage.js provides a DOM-like tree data model to compose your application and internally manages rendering cycles and drawing of your application, it also processes and distributes mouse and touch events to targeted tree nodes.

How it Works

A Stage.js application consists of a tree of nodes. Each node is pinned (transformed) against its parent and has zero, one or more image texture.

Each rendering cycle consists of ticking and drawing tree nodes. On ticking nodes adjust themselves to recent updates and then on drawing each node transforms according to its pinning and draws its textures.

Rendering is retained and is paused when there is no changed.

Sample Code edit

Loading...

Installation

Run npm install stage.js or download it manually. Use appropriate standalone builds or modules for your project and target platforms.

API Doc edit

Loading...

License

Copyright © 2015 Ali Shakiba, Piqnt LLC
Available under the MIT license