Take the code as an example,How to play the specified animation when the mouse clicks the model in the web player?
<script <removed>
<link rel="stylesheet" <removed>
<div id="player-container" style="width: 100%; height: 100vh;"></div>
<script>
new spine.SpinePlayer("player-container", {
jsonUrl: "http://esotericsoftware.com/files/examples/4.0/spineboy/export/spineboy-pro.json",
atlasUrl: "http://esotericsoftware.com/files/examples/4.0/spineboy/export/spineboy.atlas"
});
</script>
Page 1 of 1
owo
2 months ago
- owo
- Posts: 3
Mario
Here's a simple example on Codepen that plays an animation when the player's div is clicked:
https://codepen.io/badlogicgames/pen/qBKRXKW
https://codepen.io/badlogicgames/pen/qBKRXKW
2 months ago
-
Mario - Posts: 3277
owo
Thank you very much for your reply, very useful!
If a model has two PNG files of clothing textures, can the textures be switched when player's div clicked? If so how to achieve
If a model has two PNG files of clothing textures, can the textures be switched when player's div clicked? If so how to achieve
2 months ago
- owo
- Posts: 3
Mario
Use the skins feature for that:
Skins - Spine User Guide
You can pack multiple outfits into a single texture atlas so you don't have to manually load/swap png files. Just set the skin:
Skins - Spine User Guide
You can pack multiple outfits into a single texture atlas so you don't have to manually load/swap png files. Just set the skin:
player.skeleton.setSkinByName("name-of-the-skin");
2 months ago
-
Mario - Posts: 3277
Mark topic unread
• Page 1 of 1
Return to Editor
- All times are UTC