mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
* add v8 support to spine! * Renamed examples folder for consistency. * Gitignore dist. * Tsconfig. * Package json. * Modification due to strictNullChecks=true. * Run tsfmt. * Use clipper.clipTriangles not deprecated version. * Aligned example to spine-pixi (v7). * Fix clipping dark tint wrong param. * Removed useless clipper. * Push texture issue repro example * fix attachment.uvs by copying them * SlotObject alpha connected to skeleton and slot alpha. * add topology for future v8 release * Dark tint rendered is enabled if at least one slot has dark tint, or by configuration. Fixed clipping while using dark tint. * Optimized clipping by using clipTrianglesUnpacked. * Repro example for clipping issue. * Aligned constructor and from signature of spine-pixi(-v7) to v8. Deprecated old signatures. * Removed useless function. * Fixed clipping issue flagging attachment as dirty if indices change. * Clipping attachments clip slot object through Pixi Graphics masks. * Add autoUpdate in SpineFromOptions * Added javadoc to pixiv8 * Updated pixi7 examples to use SpineFromOptions interface * Aligned atlas loader to use texturePreference for bundles. * Add pool to manage slot objects masks * Fixed minor issues with SpineDebugRenderer * Aligned spine-pixi-v8 with latest spine-core * Updated build and publish script --------- Co-authored-by: Davide Tantillo <iamdjj@gmail.com>
69 lines
2.6 KiB
HTML
69 lines
2.6 KiB
HTML
<html>
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>spine-pixi-v8</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/pixi.js@8.4.1/dist/pixi.min.js"></script>
|
|
<script src="../dist/iife/spine-pixi-v8.js"></script>
|
|
<link rel="stylesheet" href="../../index.css">
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
(async function () {
|
|
var app = new PIXI.Application();
|
|
await app.init({
|
|
width: window.innerWidth,
|
|
height: window.innerHeight,
|
|
resolution: window.devicePixelRatio || 1,
|
|
autoDensity: true,
|
|
resizeTo: window,
|
|
backgroundColor: 0x2c3e50,
|
|
hello: true,
|
|
})
|
|
document.body.appendChild(app.view);
|
|
|
|
// Pre-load the skeleton data and atlas. You can also load .json skeleton data.
|
|
PIXI.Assets.add({alias: "mixAndMatchData", src: "./assets/mix-and-match-pro.skel" });
|
|
PIXI.Assets.add({alias: "mixAndMatchAtlas", src: "./assets/mix-and-match-pma.atlas" });
|
|
await PIXI.Assets.load(["mixAndMatchData", "mixAndMatchAtlas"]);
|
|
|
|
// Create the Spine display object
|
|
const mixAndMatch = spine.Spine.from({skeleton: "mixAndMatchData", atlas: "mixAndMatchAtlas",
|
|
scale: 0.5,
|
|
});
|
|
|
|
// Set the default mix time to use when transitioning
|
|
// from one animation to the next.
|
|
mixAndMatch.state.data.defaultMix = 0.2;
|
|
|
|
// Add animations.
|
|
mixAndMatch.state.setAnimation(0, "walk", true);
|
|
mixAndMatch.state.addAnimation(0, "dance", true, 1.0);
|
|
mixAndMatch.state.addAnimation(0, "walk", true, 1.0);
|
|
|
|
// Add a custom skin
|
|
const skeletonData = mixAndMatch.skeleton.data;
|
|
const skin = new spine.Skin("custom");
|
|
skin.addSkin(skeletonData.findSkin("nose/short"));
|
|
skin.addSkin(skeletonData.findSkin("skin-base"));
|
|
skin.addSkin(skeletonData.findSkin("eyes/violet"));
|
|
skin.addSkin(skeletonData.findSkin("hair/brown"));
|
|
skin.addSkin(skeletonData.findSkin("clothes/hoodie-orange"));
|
|
skin.addSkin(skeletonData.findSkin("legs/pants-jeans"));
|
|
skin.addSkin(skeletonData.findSkin("accessories/bag"));
|
|
skin.addSkin(skeletonData.findSkin("accessories/hat-red-yellow"));
|
|
skin.addSkin(skeletonData.findSkin("eyelids/girly"));
|
|
mixAndMatch.skeleton.setSkin(skin);
|
|
mixAndMatch.skeleton.setSlotsToSetupPose();
|
|
|
|
// Center the spine object on screen.
|
|
mixAndMatch.x = window.innerWidth / 2;
|
|
mixAndMatch.y = window.innerHeight / 2 + mixAndMatch.getBounds().height / 2;
|
|
|
|
// Add the display object to the stage.
|
|
app.stage.addChild(mixAndMatch);
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|