pixi.js 7.0.0-alpha → 7.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,37 +32,38 @@ import * as PIXI from 'pixi.js'
32
32
  ### Basic Usage Example
33
33
 
34
34
  ```js
35
+ import { Application, Sprite } from 'pixi.js';
36
+
35
37
  // The application will create a renderer using WebGL, if possible,
36
38
  // with a fallback to a canvas render. It will also setup the ticker
37
- // and the root stage PIXI.Container.
38
- const app = new PIXI.Application();
39
+ // and the root stage PIXI.Container
40
+ const app = new Application();
39
41
 
40
42
  // The application will create a canvas element for you that you
41
- // can then insert into the DOM.
43
+ // can then insert into the DOM
42
44
  document.body.appendChild(app.view);
43
45
 
44
46
  // load the texture we need
45
- app.loader.add('bunny', 'bunny.png').load((loader, resources) => {
47
+ const texture = await Assets.load('bunny.png');
46
48
 
47
- // This creates a texture from a 'bunny.png' image.
48
- const bunny = new PIXI.Sprite(resources.bunny.texture);
49
+ // This creates a texture from a 'bunny.png' image
50
+ const bunny = new Sprite(texture);
49
51
 
50
- // Setup the position of the bunny
51
- bunny.x = app.renderer.width / 2;
52
- bunny.y = app.renderer.height / 2;
52
+ // Setup the position of the bunny
53
+ bunny.x = app.renderer.width / 2;
54
+ bunny.y = app.renderer.height / 2;
53
55
 
54
- // Rotate around the center
55
- bunny.anchor.x = 0.5;
56
- bunny.anchor.y = 0.5;
56
+ // Rotate around the center
57
+ bunny.anchor.x = 0.5;
58
+ bunny.anchor.y = 0.5;
57
59
 
58
- // Add the bunny to the scene we are building.
59
- app.stage.addChild(bunny);
60
+ // Add the bunny to the scene we are building
61
+ app.stage.addChild(bunny);
60
62
 
61
- // Listen for frame updates
62
- app.ticker.add(() => {
63
- // each frame we spin the bunny around a bit
64
- bunny.rotation += 0.01;
65
- });
63
+ // Listen for frame updates
64
+ app.ticker.add(() => {
65
+ // each frame we spin the bunny around a bit
66
+ bunny.rotation += 0.01;
66
67
  });
67
68
  ```
68
69