1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>spine-pixi</title>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pixi.min.js"></script>
- <script src="../dist/iife/spine-pixi-v7.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/tweakpane.min.js"></script>
- <link rel="stylesheet" href="../../index.css">
- </head>
- <body>
- <script>
- (async function () {
- var app = new PIXI.Application({
- width: window.innerWidth,
- height: window.innerHeight,
- resolution: window.devicePixelRatio || 1,
- autoDensity: true,
- resizeTo: window,
- backgroundColor: 0x333333,
- hello: true,
- });
- document.body.appendChild(app.view);
- // Pre-load the skeleton data and atlas. You can also load .json skeleton data.
- PIXI.Assets.add("snowglobeData", "./assets/snowglobe-pro.skel");
- PIXI.Assets.add("snowglobeAtlas", "./assets/snowglobe-pma.atlas");
- await PIXI.Assets.load(["snowglobeData", "snowglobeAtlas"]);
- // Create the spine display object
- const snowglobe = spine.Spine.from({skeleton: "snowglobeData", atlas: "snowglobeAtlas",
- scale: 0.25,
- });
- // Center the spine object on screen.
- snowglobe.x = window.innerWidth / 2;
- snowglobe.y = window.innerHeight / 2 + snowglobe.getBounds().height / 4;
- // Set animation "FOA" on track 0, looped.
- snowglobe.state.setAnimation(0, "shake", true);
- // Add the display object to the stage.
- app.stage.addChild(snowglobe);
- })();
- </script>
- </body>
- </html>
|