Piqnt
Stage.js

Stage.js is a 2D HTML5 JavaScript library for cross-platform game development, it is lightweight, fast and open-source.

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 textures.

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 bower install stage-js to get the latest release or download it manually. Use appropriate standalone builds or modules for your project and target platforms.

API Doc edit

Loading...