mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Better scale.
This commit is contained in:
parent
378a413863
commit
fbd9a2057e
@ -44,8 +44,8 @@
|
|||||||
<div id="message"></div>
|
<div id="message"></div>
|
||||||
<div><canvas id="canvas" width="640" height="480"/></div>
|
<div><canvas id="canvas" width="640" height="480"/></div>
|
||||||
<br>
|
<br>
|
||||||
<input type="button" value="Spineboy" onclick="load('spineboy')">
|
<input type="button" value="Spineboy" onclick="load('spineboy', 0.6)">
|
||||||
<input type="button" value="Goblins" onclick="load('goblins')">
|
<input type="button" value="Goblins" onclick="load('goblins', 1)">
|
||||||
Click above to change the animation (Spineboy) or skin (Goblins).
|
Click above to change the animation (Spineboy) or skin (Goblins).
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -54,16 +54,16 @@ var TurbulenzEngine = WebGLTurbulenzEngine.create({canvas: canvas});
|
|||||||
var graphicsDevice = TurbulenzEngine.createGraphicsDevice({});
|
var graphicsDevice = TurbulenzEngine.createGraphicsDevice({});
|
||||||
var draw2D = Draw2D.create({graphicsDevice: graphicsDevice});
|
var draw2D = Draw2D.create({graphicsDevice: graphicsDevice});
|
||||||
|
|
||||||
load("spineboy");
|
load("spineboy", 0.6);
|
||||||
//load("goblins");
|
//load("goblins", 1);
|
||||||
|
|
||||||
var skeletonName;
|
|
||||||
function load (name) {
|
|
||||||
skeletonName = name;
|
|
||||||
TurbulenzEngine.request("data/" + skeletonName + ".atlas", loadAtlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
var atlas;
|
var atlas;
|
||||||
|
var skeletonData;
|
||||||
|
var skeletonName;
|
||||||
|
function load (name, scale) {
|
||||||
|
skeletonName = name;
|
||||||
|
TurbulenzEngine.request("data/" + skeletonName + ".atlas", loadAtlas);
|
||||||
|
|
||||||
function loadAtlas (atlasText) {
|
function loadAtlas (atlasText) {
|
||||||
var textureCount = 0;
|
var textureCount = 0;
|
||||||
atlas = new spine.Atlas(atlasText, {
|
atlas = new spine.Atlas(atlasText, {
|
||||||
@ -85,6 +85,7 @@ function loadAtlas (atlasText) {
|
|||||||
texture.destroy();
|
texture.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function waitForTextures () {
|
function waitForTextures () {
|
||||||
if (!textureCount)
|
if (!textureCount)
|
||||||
TurbulenzEngine.request("data/" + skeletonName + ".json", loadSkeletonData);
|
TurbulenzEngine.request("data/" + skeletonName + ".json", loadSkeletonData);
|
||||||
@ -92,15 +93,15 @@ function loadAtlas (atlasText) {
|
|||||||
setTimeout(waitForTextures, 100);
|
setTimeout(waitForTextures, 100);
|
||||||
}
|
}
|
||||||
waitForTextures();
|
waitForTextures();
|
||||||
}
|
|
||||||
|
|
||||||
var skeletonData;
|
|
||||||
function loadSkeletonData (skeletonText) {
|
function loadSkeletonData (skeletonText) {
|
||||||
var json = new spine.SkeletonJson(new spine.AtlasAttachmentLoader(atlas));
|
var json = new spine.SkeletonJson(new spine.AtlasAttachmentLoader(atlas));
|
||||||
json.scale = 0.6;
|
json.scale = scale;
|
||||||
skeletonData = json.readSkeletonData(JSON.parse(skeletonText));
|
skeletonData = json.readSkeletonData(JSON.parse(skeletonText));
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function start () {
|
function start () {
|
||||||
spine.Bone.yDown = true;
|
spine.Bone.yDown = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user