-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
dispose.html
41 lines (36 loc) · 1023 Bytes
/
dispose.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="../dist/iife/spine-player.js"></script>
<link rel="stylesheet" href="../css/spine-player.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../index.css" />
</head>
<body class="flex flex-col" style="gap: 1em;">
<div id="container" style="width:640px; height:380px"></div>
<button id="dispose" style="align-self: flex-start;">Dispose</button>
</body>
<script>
var player = createPlayer();
document.getElementById("dispose").addEventListener("click", event => {
console.log("Disposing player.");
player.dispose();
player = createPlayer();
});
function createPlayer() {
return new spine.SpinePlayer("container", {
skelUrl: "assets/spineboy-pro.skel",
atlasUrl: "assets/spineboy-pma.atlas",
animation: "run",
premultipliedAlpha: true,
backgroundColor: "#cccccc",
viewport: {
debugRender: true,
},
showControls: true
});
}
</script>
</body>
</html>