From cf6251816bbe68d0bc45638cdbe8cb352d9470b2 Mon Sep 17 00:00:00 2001 From: Nuno Miranda <38939683+nuno-miranda@users.noreply.github.com> Date: Fri, 21 Dec 2018 16:02:43 +0000 Subject: [PATCH] PixiJS Library (#27412) * PixiJS library * missing extension * Rename guide/english/canvas/PixiJS.md to guide/english/canvas/pixi-js/index.md * fix: added frontmatter --- guide/english/canvas/pixi-js/index.md | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 guide/english/canvas/pixi-js/index.md diff --git a/guide/english/canvas/pixi-js/index.md b/guide/english/canvas/pixi-js/index.md new file mode 100644 index 0000000000..085fbf5722 --- /dev/null +++ b/guide/english/canvas/pixi-js/index.md @@ -0,0 +1,42 @@ +--- +title: PixiJS +--- + +## PixiJS + +# Introduction + +Pixi.js is an open source, cross browser JavaScript 2D WebGL graphics library with canvas fallback. + +# Example 1 + +The rotating bunny + +``` +var app = new PIXI.Application(800, 600, {backgroundColor : 0x1099bb}); +document.body.appendChild(app.view); + +// create a new Sprite from an image path +var bunny = PIXI.Sprite.fromImage('required/assets/basics/bunny.png') + +// center the sprite's anchor point +bunny.anchor.set(0.5); + +// move the sprite to the center of the screen +bunny.x = app.screen.width / 2; +bunny.y = app.screen.height / 2; + +app.stage.addChild(bunny); + +// Listen for animate update +app.ticker.add(function(delta) { + // just for fun, let's rotate mr rabbit a little + // delta is 1 if running at 100% performance + // creates frame-independent transformation + bunny.rotation += 0.1 * delta; +}); + +``` + + +You can find this running example here: http://pixijs.io/examples/index.html#/basics/basic.js