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 +20 -19
- package/dist/browser/pixi.js +196 -200
- package/dist/browser/pixi.js.map +1 -1
- package/dist/browser/pixi.min.js +81 -81
- package/dist/browser/pixi.min.js.map +1 -1
- package/dist/browser/pixi.min.mjs +95 -95
- package/dist/browser/pixi.min.mjs.map +1 -1
- package/dist/browser/pixi.mjs +196 -196
- package/dist/browser/pixi.mjs.map +1 -1
- package/dist/cjs/pixi.js +2 -2
- package/dist/cjs/pixi.js.map +1 -1
- package/dist/cjs/pixi.min.js +2 -2
- package/dist/cjs/pixi.min.js.map +1 -1
- package/dist/esm/pixi.min.mjs +2 -2
- package/dist/esm/pixi.min.mjs.map +1 -1
- package/dist/esm/pixi.mjs +2 -2
- package/dist/esm/pixi.mjs.map +1 -1
- package/index.d.ts +5 -3
- package/package.json +31 -31
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
|
|
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
|
-
|
|
47
|
+
const texture = await Assets.load('bunny.png');
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
// This creates a texture from a 'bunny.png' image
|
|
50
|
+
const bunny = new Sprite(texture);
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
// Setup the position of the bunny
|
|
53
|
+
bunny.x = app.renderer.width / 2;
|
|
54
|
+
bunny.y = app.renderer.height / 2;
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// Rotate around the center
|
|
57
|
+
bunny.anchor.x = 0.5;
|
|
58
|
+
bunny.anchor.y = 0.5;
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
// Add the bunny to the scene we are building
|
|
61
|
+
app.stage.addChild(bunny);
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|