Giter VIP home page Giter VIP logo

ember-cli-pixijs's Introduction

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:

import 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:

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

export default PixiCanvas.extend({
  draw() {
    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);
  }
});

Installation

Installing the addon is as easy as:

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

ember-cli-pixijs's People

Contributors

ember-tomster avatar marcoow avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.