Skip to content

Commit 9e84217

Browse files
committed
Improve WebGL example
1 parent 8dd3e95 commit 9e84217

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

spine-ts/spine-webgl/example/darktint.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!DOCTYPE html>
22
<html>
3+
34
<head>
45
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -14,7 +15,10 @@
1415

1516
<body>
1617
<canvas id="canvas" style="position: absolute; width: 100%; height: 100%;"></canvas>
18+
<span id="isPma" style="position: absolute; color: #22cc22"></span>
1719
<script>
20+
const pma = true;
21+
document.querySelector("#isPma").innerText = "PMA: " + pma;
1822
class App {
1923
constructor() {
2024
this.skeleton = null;
@@ -23,16 +27,16 @@
2327

2428
loadAssets(canvas) {
2529
// Load the skeleton file.
26-
canvas.assetManager.loadJson("assets/orange.json");
30+
canvas.assetManager.loadJson(`assets/orange${pma ? "-pma" : ""}.json`);
2731
// Load the atlas and its pages.
28-
canvas.assetManager.loadTextureAtlas("assets/orange.atlas");
32+
canvas.assetManager.loadTextureAtlas(`assets/orange${pma ? "-pma" : ""}.atlas`);
2933
}
3034

3135
initialize(canvas) {
3236
let assetManager = canvas.assetManager;
3337

3438
// Create the texture atlas.
35-
var atlas = assetManager.require("assets/orange.atlas");
39+
var atlas = assetManager.require(`assets/orange${pma ? "-pma" : ""}.atlas`);
3640

3741
// Create a AtlasAttachmentLoader that resolves region, mesh, boundingbox and path attachments
3842
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
@@ -42,7 +46,7 @@
4246

4347
// Set the scale to apply during parsing, parse the file, and create a new skeleton.
4448
skeletonBinary.scale = 8;
45-
var skeletonData = skeletonBinary.readSkeletonData(assetManager.require("assets/orange.json"));
49+
var skeletonData = skeletonBinary.readSkeletonData(assetManager.require(`assets/orange${pma ? "-pma" : ""}.json`));
4650
this.skeleton = new spine.Skeleton(skeletonData);
4751

4852
// Create an AnimationState, and set the "cape-follow-example" animation in looping mode.
@@ -72,7 +76,7 @@
7276
// Begin rendering.
7377
renderer.begin();
7478
// Draw the skeleton
75-
renderer.drawSkeleton(this.skeleton, true);
79+
renderer.drawSkeleton(this.skeleton, pma);
7680
// Complete rendering.
7781
renderer.end();
7882
}

0 commit comments

Comments
 (0)