simplabs/ember-cli-pixijs

Name: ember-cli-pixijs

Owner: simplabs

Description: An Ember CLI Addon that wraps pixi.js

Created: 2016-02-10 15:27:32.0

Updated: 2018-04-04 10:17:23.0

Pushed: 2018-05-17 09:59:38.0

Homepage: null

Size: 194

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

ember-cli-pixijs

ember-cli-pixijs wraps the pixi.js HTML5 2D rendering engine so that it can easily be used in Ember.js applications:

rt PIXI from 'pixi';

It also defines a PixiCanvas component that can be used to display canvases rendered with pixi.js in Ember.js applications. The component handles creating a pixi.js renderer, inserting the canvas into the DOM and replacing it when the dimensions change. Whenever the canvas is (re-)rendered, the component's draw method is called that handles the actual drawing with pixi.js.

A concrete subclass of the PixiCanvas component might look sth. like this:

pp/components/my-pixi-component.js
rt PIXI from 'pixi';
rt PixiCanvas from 'ember-cli-pixijs/components/pixi-canvas';

rt default PixiCanvas.extend({
aw() {
const renderer = this.get('pixiRenderer');
const stage = new PIXI.Container();

const graphics = new PIXI.Graphics();

// set a fill and line style
graphics.beginFill(0xFF3300);
graphics.lineStyle(10, 0xffd900, 1);

// draw a shape
graphics.moveTo(50, 50);
graphics.lineTo(250, 50);
graphics.lineTo(100, 100);
graphics.lineTo(250, 220);
graphics.lineTo(50, 220);
graphics.lineTo(50, 50);
graphics.endFill();

stage.addChild(graphics);

renderer.render(stage);


Installation

Installing the addon is as easy as:

r install ember-cli-pixijs
License

ember-cli-pixijs is developed by and © simplabs GmbH/Marco Otte-Witte and contributors. It is released under the MIT License.

ember-cli-pixijs is not an official part of Ember.js and is not maintained by the Ember.js Core Team.

pixi.js is developed by and © Mathew Groves.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.