Deprecated! This repository is now deprecated, please use the upstream project Pixi.JS v3+. It has now been migrated to a modular architecture.
Node Pixi Renderer
This is a fork of Pixi.JS mainly for use with browserify, but has also went in a slightly different direction in terms of programming style.
node-pixi matches the public Pixi.JS API, but now modular with browserify. In a later major version, the public API and architecture may change to no longer match Pixi.JS. If/when such a split occurs the project's major version and branching will be updated occordingly, and the latest major version with full compatibility with Pixi.JS will containue to be maintained.
Basically I am open to MAJOR refactors if appropriate. In the future, the goals may differ from Pixi.JS, and I may streamline things to only on WebGL, and maybe sooner rather than later (Saying goodbye to context 2d). This is all a maybe, as the web is moving fast, and Pixi.JS may actually make this move before this project.
Pixi.JS JavaScript 2D Renderer
The aim of this project is to provide a fast lightweight 2D library that works across all devices. The Pixi renderer allows everyone to enjoy the power of hardware acceleration without prior knowledge of WebGL. Also its fast.
This content is released under the (http://opensource.org/licenses/MIT) MIT License.
Examples
- Basics
- SpriteSheet
- MovieClip
- Balls
- Morph
- Interactivity
- Transparent Background
- Dragging
- Tiling Texture
- Text
- RenderTexture
- Spine
- Graphics
- Masking
- Filters
Install
node-pixi can be installed with Node and NPM.
npm install pixi
Usage
Basic
Once installed as a node_module
, it can now be used in node and with browserify.
Example main.js:
// Require pixi modulevar pixi = ; // You can use either WebGLRenderer or CanvasRenderervar renderer = pixi;documentbody; var stage = ;var bunnyTexture = pixiTexture;var bunny = bunnyTexture; bunnypositionx = 400;bunnypositiony = 300;bunnyscalex = 2;bunnyscaley = 2; stage; ; { bunnyrotation += 001; renderer; ;}
Alternative
You can completely bypass requiring the main pixi
module, and go directly for the submodules. Doing this makes sure you only require what you need when you need it.
Example main.js:
// Require modulesvar Sprite = ;var Stage = ;var Texture = ;var WebGLRenderer = ; var renderer = ;documentbody; var stage = ;// ... etc ...
Build
node-pixi can be compiled with Grunt. If you don't already have this, go install Node and NPM then install the Grunt Command Line.
npm install -g grunt-cli
Get the source:
git clone https://github.com/drkibitz/node-pixi.git
Within your clone repository, install the devDependencies
using NPM:
cd path/to/clone/npm install
You should now be able to build node-pixi with Grunt:
grunt
Look in the Gruntfile.js
for task configuration.
Important Notes
It's important to clone the source, and not assume that the source is the same is what is published to NPM. The package on NPM is and should be considered a distributed release only, and is not compatible with the build process outlined here. To avoid any confusion about this, the published package.json has NO devDependencies
, while the devDependencies
of the source package.json
remain.
The source may still be installed via NPM directly from Github. There are a few ways to define a URL to do this, just read npm-faq. If meant as a package dependency, I prefer using Github tarballs rather than the Git protocol to avoiding transferring the history. This is a significantly faster installation:
npm install https://github.com/drkibitz/node-pixi/archive/master.tar.gz
The default task is only slightly different from the task meant for continious integration. Both tasks build and test the bundles for debug and release, and copy the bundles to the dist directory, which are meant to be committed only by a repository maintainer. The difference is the default task creates project analysis reports using plato, and the ci task submits code coverage.
Contribute
Want to contribute to node-pixi? Just make a pull request or a suggestion on Github. Please make sure you write tests, and run them before committing changes.
If you followed the steps in the Build section, then you can now run the tests locally:
grunt test
- The test suite uses the karma-runner
- The test suite expects Chrome to be installed (Configured in
Gruntfile.js
) - Tests run for every Travis CI build
- Code coverage is submitted to coveralls when running
grunt travis
Coming Soon
- node-pixi goals
- node-pixi roadmap
- node-pixi documentation
- either update wiki, or remove it
- complete unit tests, and working functional tests