/
index.html
130 lines (121 loc) · 5.29 KB
/
index.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<html>
<script src="../../build/spine-widget.js"></script>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<body>
<center>
<!-- You can programmatically initialize a widget -->
<div id="spine-widget" style="margin-bottom: 20px; width: 640px; height: 480px;"></div>
<!-- You can also specify your own x/y and scale for the skeleton -->
<div style="margin-bottom: 20px; width: 100%; height: 150px;" class="spine-widget" data-json="assets/raptor-pro.json" data-atlas="assets/raptor.atlas" data-animation="jump" data-fit-to-canvas="false" data-scale="0.1" data-x="200" data-y="10"></div>
<!-- Or make things real small -->
<div style="margin-bottom: 20px; width: 320px; height: 240px;" class="spine-widget" data-json="assets/raptor-pro.json" data-atlas="assets/raptor.atlas" data-animation="walk" data-background-color="#cc0000"></div>
<!-- You can also specify the .JSON and .atlas files inline to reduce the number of requests made to the server -->
<div id="spine-widget-inline" style="margin-bottom: 20px; width: 640px; height: 480px;"></div>
</center>
</body>
<script id="atlas" type="text/plain">
spine-logo.png
size: 128,64
format: RGBA8888
filter: Linear,Linear
repeat: none
logo
rotate: false
xy: 2, 2
size: 104, 32
orig: 104, 32
offset: 0, 0
index: -1
</script>
<script id="atlasPage" type="text/plain">
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABACAYAAADS1n9/AAAFLElEQVR42u2bTWhVRxTH//myJtTmGT+SYEvTFGvTRBOTV8tLbXwL0e3bZCEiBtRuzUa6ElJX2QgKiqibiG4MfiSCiHaToohowQQEUSh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CkFRlUU1OLYiSTnrAEkKQC0EpVnsiizGSPDDZqsMlLpFjEoETVmvOG3qW88v4ma8ckaQXYFsYTUKlZIEmmodLkKXSVa2HUCwDMsgi3EiiODwIzgEcimRRm17pG+ZCcE5uL7flb/52l1Xg7p97dg38T0m7vbj7rtf8C7ICaQgJOcDlSAA/VGn1liCOAexlvgHk61sZwGuR7ZimO2ZrgdSBjzq/Nv2mIhiZwt2Ru0GfBLCUgvAtOLZWlkPg8L2/urKUGwhKOxFk6DAVKzNg80YjBLA9pVwrqKpuxGXEz61dO5TrZNro166kc+WvlNLFmWQ1WXJtxQZNZMkyMX2a6K2BrWzWcyaBv9KD67II6JSk2pTnFN/JSyNbDoubcvQduo7nHowgAe3enHr6Lc4OpTBEEh1CIBQAIQCIFUtgN7P0Ssvhz76EY/kq2GPt+Dx8xyeH/oKhzgiZUZ9vbxcZc+9bdhr2gnIN4k4IlVAVxO6Pm7DR10A+9uxn9GpEqQqKO8IyjeEb27CzT2t2MOoEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQpYG/wPiudlO23hTHQAAAABJRU5ErkJggg==
</script>
<script id="json" type="text/plain">
{
"skeleton": { "hash": "MYXtB/H4Z2fp6J+/XZiyN+f9Hfc", "spine": "3.5.49", "width": 104, "height": 32, "images": "" },
"bones": [
{ "name": "root" }
],
"slots": [
{ "name": "spine-logo", "bone": "root", "attachment": "logo" }
],
"skins": {
"default": {
"spine-logo": {
"logo": { "width": 104, "height": 32 }
}
}
},
"animations": {
"animation": {
"bones": {
"root": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.8333, "angle": 39.96 },
{ "time": 1.6667, "angle": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1 },
{ "time": 0.8333, "x": 3, "y": 3 },
{ "time": 1.6667, "x": 1, "y": 1 }
]
}
}
}
}
}
</script>
<script>
function supportsWebGL() {
try {
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
return ctx != null;
} catch(e) {
return false;
}
}
if (!supportsWebGL()) {
alert('WebGL is unavailable.');
}
spineWidget = new spine.SpineWidget("spine-widget", {
json: "assets/spineboy-ess.json",
atlas: "assets/spineboy.atlas",
animation: "run",
backgroundColor: "#00000000",
debug: true,
success: function (widget) {
var animIndex = 0;
widget.canvas.onclick = function () {
animIndex++;
var animations = widget.skeleton.data.animations;
if (animIndex >= animations.length) animIndex = 0;
widget.setAnimation(animations[animIndex].name);
}
}
});
json = document.getElementById("json").innerHTML;
atlas = document.getElementById("atlas").innerHTML;
atlasPageContent = document.getElementById("atlasPage").innerHTML;
spineWidgetInline = new spine.SpineWidget("spine-widget-inline", {
jsonContent: json,
atlasContent: atlas,
atlasPages: ["spine-logo.png"],
atlasPagesContent: [atlasPageContent],
animation: "animation",
backgroundColor: "#00000000",
debug: true,
success: function (widget) {
var animIndex = 0;
widget.canvas.onclick = function () {
animIndex++;
let animations = widget.skeleton.data.animations;
if (animIndex >= animations.length) animIndex = 0;
widget.setAnimation(animations[animIndex].name);
}
}
});
</script>
</body>
</html>