[ts] Added ClippingAttachment and loading in SkeletonJson. Updated coin example

This commit is contained in:
badlogic 2017-04-11 15:30:34 +02:00
parent b043a0b967
commit 778055ae5b
13 changed files with 9959 additions and 9309 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
{ {
"skeleton": { "hash": "rNc8k+39sqArL/posag7CkAFfTo", "spine": "3.6.14-beta", "width": 260, "height": 359.92, "images": "" }, "skeleton": { "hash": "4cI0KYdFTZbO7vkQYPFQN+yauDw", "spine": "3.6.14-beta", "width": 260, "height": 359.92, "images": "./images/" },
"bones": [ "bones": [
{ "name": "root" }, { "name": "root" },
{ "name": "coin-root", "parent": "root", "y": 300, "color": "ff0000ff" }, { "name": "coin-root", "parent": "root", "y": 300, "color": "ff0000ff" },
@ -8,9 +8,9 @@
{ "name": "shine", "parent": "coin-root", "rotation": -24.17, "scaleY": 1.478, "color": "ffffffff" } { "name": "shine", "parent": "coin-root", "rotation": -24.17, "scaleY": 1.478, "color": "ffffffff" }
], ],
"slots": [ "slots": [
{ "name": "images/coin", "bone": "coin", "attachment": "images/coin" }, { "name": "images/coin", "bone": "coin", "attachment": "coin" },
{ "name": "clipping", "bone": "clipping", "attachment": "clipping" }, { "name": "clipping", "bone": "clipping", "attachment": "clipping" },
{ "name": "images/shine", "bone": "shine", "color": "ffffff93", "attachment": "images/shine", "blend": "additive" } { "name": "images/shine", "bone": "shine", "color": "ffffff93", "attachment": "shine", "blend": "additive" }
], ],
"skins": { "skins": {
"default": { "default": {
@ -24,7 +24,7 @@
} }
}, },
"images/coin": { "images/coin": {
"images/coin": { "coin": {
"type": "mesh", "type": "mesh",
"uvs": [ 1, 1, 0.51662, 0.99661, 0.38311, 0.99567, 0.29957, 0.96664, 0.22817, 0.93237, 0.16736, 0.88777, 0.11597, 0.83202, 0.06732, 0.76058, 0.03288, 0.69072, 0.00816, 0.61391, 0, 0.52843, 0, 0.43778, 0.02307, 0.33992, 0.06544, 0.24204, 0.11924, 0.16659, 0.17691, 0.10919, 0.24399, 0.06252, 0.31853, 0.02742, 0.41818, 0.0076, 0.52609, 1.0E-5, 1, 0, 0.45994, 0.99066, 0.37873, 0.97119, 0.30719, 0.94057, 0.24626, 0.89841, 0.19491, 0.85157, 0.14893, 0.79961, 0.11299, 0.73943, 0.08595, 0.67565, 0.06609, 0.60105, 0.05753, 0.52647, 0.05856, 0.44906, 0.07176, 0.36094, 0.10407, 0.28078, 0.15657, 0.19211, 0.22811, 0.1162, 0.29907, 0.0658, 0.38388, 0.02814, 0.46119, 0.00993 ], "uvs": [ 1, 1, 0.51662, 0.99661, 0.38311, 0.99567, 0.29957, 0.96664, 0.22817, 0.93237, 0.16736, 0.88777, 0.11597, 0.83202, 0.06732, 0.76058, 0.03288, 0.69072, 0.00816, 0.61391, 0, 0.52843, 0, 0.43778, 0.02307, 0.33992, 0.06544, 0.24204, 0.11924, 0.16659, 0.17691, 0.10919, 0.24399, 0.06252, 0.31853, 0.02742, 0.41818, 0.0076, 0.52609, 1.0E-5, 1, 0, 0.45994, 0.99066, 0.37873, 0.97119, 0.30719, 0.94057, 0.24626, 0.89841, 0.19491, 0.85157, 0.14893, 0.79961, 0.11299, 0.73943, 0.08595, 0.67565, 0.06609, 0.60105, 0.05753, 0.52647, 0.05856, 0.44906, 0.07176, 0.36094, 0.10407, 0.28078, 0.15657, 0.19211, 0.22811, 0.1162, 0.29907, 0.0658, 0.38388, 0.02814, 0.46119, 0.00993 ],
"triangles": [ 38, 18, 19, 37, 17, 18, 37, 18, 38, 36, 16, 17, 36, 17, 37, 35, 15, 16, 35, 16, 36, 34, 14, 15, 34, 15, 35, 34, 33, 13, 34, 13, 14, 12, 13, 33, 32, 12, 33, 11, 12, 32, 31, 11, 32, 31, 10, 11, 30, 10, 31, 31, 33, 30, 29, 30, 33, 29, 9, 10, 29, 10, 30, 32, 33, 31, 34, 28, 29, 8, 9, 29, 8, 29, 28, 33, 34, 29, 25, 26, 27, 7, 8, 28, 7, 28, 27, 27, 28, 25, 26, 7, 27, 6, 7, 26, 34, 36, 28, 28, 36, 25, 6, 26, 25, 5, 6, 25, 34, 35, 36, 37, 24, 25, 5, 25, 24, 4, 5, 24, 36, 37, 25, 22, 23, 24, 4, 24, 23, 3, 4, 23, 24, 21, 22, 3, 23, 22, 38, 24, 37, 24, 1, 21, 2, 22, 21, 3, 22, 2, 1, 38, 19, 1, 24, 38, 2, 21, 1, 19, 20, 0, 1, 19, 0 ], "triangles": [ 38, 18, 19, 37, 17, 18, 37, 18, 38, 36, 16, 17, 36, 17, 37, 35, 15, 16, 35, 16, 36, 34, 14, 15, 34, 15, 35, 34, 33, 13, 34, 13, 14, 12, 13, 33, 32, 12, 33, 11, 12, 32, 31, 11, 32, 31, 10, 11, 30, 10, 31, 31, 33, 30, 29, 30, 33, 29, 9, 10, 29, 10, 30, 32, 33, 31, 34, 28, 29, 8, 9, 29, 8, 29, 28, 33, 34, 29, 25, 26, 27, 7, 8, 28, 7, 28, 27, 27, 28, 25, 26, 7, 27, 6, 7, 26, 34, 36, 28, 28, 36, 25, 6, 26, 25, 5, 6, 25, 34, 35, 36, 37, 24, 25, 5, 25, 24, 4, 5, 24, 36, 37, 25, 22, 23, 24, 4, 24, 23, 3, 4, 23, 24, 21, 22, 3, 23, 22, 38, 24, 37, 24, 1, 21, 2, 22, 21, 3, 22, 2, 1, 38, 19, 1, 24, 38, 2, 21, 1, 19, 20, 0, 1, 19, 0 ],
@ -34,7 +34,7 @@
"width": 259, "width": 259,
"height": 245 "height": 245
}, },
"images/coin-invert": { "coin-invert": {
"type": "mesh", "type": "mesh",
"uvs": [ 0.61921, 0.00932, 0.70137, 0.03058, 0.76675, 0.06301, 0.82357, 0.10192, 0.86533, 0.14084, 0.90128, 0.1866, 0.92763, 0.22768, 0.95707, 0.28353, 0.97795, 0.33937, 0.99074, 0.38663, 1, 0.45194, 1, 0.50671, 1, 0.56148, 0.98993, 0.62238, 0.97282, 0.6757, 0.95125, 0.73083, 0.91771, 0.78704, 0.88283, 0.83498, 0.84141, 0.87966, 0.79349, 0.91785, 0.73701, 0.95172, 0.65999, 0.98127, 0.60659, 0.991, 0.51662, 0.99661, 0, 1, 0, 0, 0.52609, 1.0E-5, 0.57849, 0.98348, 0.64806, 0.96162, 0.70899, 0.92882, 0.75987, 0.89639, 0.80219, 0.85685, 0.83745, 0.81722, 0.86381, 0.77794, 0.89445, 0.72582, 0.9167, 0.67213, 0.93142, 0.61628, 0.94164, 0.56011, 0.94506, 0.50823, 0.9437, 0.45454, 0.93514, 0.39905, 0.91905, 0.34031, 0.89748, 0.28194, 0.8691, 0.2284, 0.83932, 0.18768, 0.79995, 0.143, 0.76298, 0.10841, 0.71814, 0.07598, 0.66748, 0.04824, 0.61408, 0.0277, 0.5665, 0.01437 ], "uvs": [ 0.61921, 0.00932, 0.70137, 0.03058, 0.76675, 0.06301, 0.82357, 0.10192, 0.86533, 0.14084, 0.90128, 0.1866, 0.92763, 0.22768, 0.95707, 0.28353, 0.97795, 0.33937, 0.99074, 0.38663, 1, 0.45194, 1, 0.50671, 1, 0.56148, 0.98993, 0.62238, 0.97282, 0.6757, 0.95125, 0.73083, 0.91771, 0.78704, 0.88283, 0.83498, 0.84141, 0.87966, 0.79349, 0.91785, 0.73701, 0.95172, 0.65999, 0.98127, 0.60659, 0.991, 0.51662, 0.99661, 0, 1, 0, 0, 0.52609, 1.0E-5, 0.57849, 0.98348, 0.64806, 0.96162, 0.70899, 0.92882, 0.75987, 0.89639, 0.80219, 0.85685, 0.83745, 0.81722, 0.86381, 0.77794, 0.89445, 0.72582, 0.9167, 0.67213, 0.93142, 0.61628, 0.94164, 0.56011, 0.94506, 0.50823, 0.9437, 0.45454, 0.93514, 0.39905, 0.91905, 0.34031, 0.89748, 0.28194, 0.8691, 0.2284, 0.83932, 0.18768, 0.79995, 0.143, 0.76298, 0.10841, 0.71814, 0.07598, 0.66748, 0.04824, 0.61408, 0.0277, 0.5665, 0.01437 ],
"triangles": [ 50, 26, 0, 49, 50, 0, 48, 0, 1, 49, 0, 48, 47, 1, 2, 48, 1, 47, 46, 47, 2, 46, 2, 3, 45, 46, 3, 45, 3, 4, 44, 45, 4, 44, 4, 5, 43, 44, 5, 43, 5, 6, 42, 43, 6, 42, 6, 7, 41, 42, 7, 41, 7, 8, 40, 41, 8, 40, 8, 9, 39, 40, 9, 10, 39, 9, 39, 10, 11, 38, 39, 11, 41, 40, 38, 38, 40, 39, 38, 11, 12, 37, 38, 12, 38, 36, 41, 37, 36, 38, 13, 37, 12, 36, 37, 13, 36, 43, 41, 41, 43, 42, 14, 36, 13, 35, 36, 14, 44, 43, 36, 35, 34, 36, 15, 35, 14, 34, 35, 15, 44, 36, 45, 34, 33, 36, 16, 34, 15, 33, 34, 16, 48, 47, 49, 36, 33, 45, 17, 33, 16, 32, 33, 17, 32, 31, 33, 18, 32, 17, 31, 32, 18, 33, 29, 45, 45, 47, 46, 31, 30, 33, 19, 30, 31, 19, 31, 18, 49, 47, 45, 30, 29, 33, 20, 29, 30, 20, 30, 19, 50, 49, 29, 45, 29, 49, 21, 28, 29, 21, 29, 20, 29, 27, 50, 28, 27, 29, 22, 27, 28, 22, 28, 21, 23, 25, 26, 23, 26, 50, 23, 50, 27, 23, 27, 22, 24, 25, 23 ], "triangles": [ 50, 26, 0, 49, 50, 0, 48, 0, 1, 49, 0, 48, 47, 1, 2, 48, 1, 47, 46, 47, 2, 46, 2, 3, 45, 46, 3, 45, 3, 4, 44, 45, 4, 44, 4, 5, 43, 44, 5, 43, 5, 6, 42, 43, 6, 42, 6, 7, 41, 42, 7, 41, 7, 8, 40, 41, 8, 40, 8, 9, 39, 40, 9, 10, 39, 9, 39, 10, 11, 38, 39, 11, 41, 40, 38, 38, 40, 39, 38, 11, 12, 37, 38, 12, 38, 36, 41, 37, 36, 38, 13, 37, 12, 36, 37, 13, 36, 43, 41, 41, 43, 42, 14, 36, 13, 35, 36, 14, 44, 43, 36, 35, 34, 36, 15, 35, 14, 34, 35, 15, 44, 36, 45, 34, 33, 36, 16, 34, 15, 33, 34, 16, 48, 47, 49, 36, 33, 45, 17, 33, 16, 32, 33, 17, 32, 31, 33, 18, 32, 17, 31, 32, 18, 33, 29, 45, 45, 47, 46, 31, 30, 33, 19, 30, 31, 19, 31, 18, 49, 47, 45, 30, 29, 33, 20, 29, 30, 20, 30, 19, 50, 49, 29, 45, 29, 49, 21, 28, 29, 21, 29, 20, 29, 27, 50, 28, 27, 29, 22, 27, 28, 22, 28, 21, 23, 25, 26, 23, 26, 50, 23, 50, 27, 23, 27, 22, 24, 25, 23 ],
@ -46,7 +46,7 @@
} }
}, },
"images/shine": { "images/shine": {
"images/shine": { "width": 72, "height": 245 } "shine": { "width": 72, "height": 245 }
} }
} }
}, },
@ -55,7 +55,7 @@
"slots": { "slots": {
"images/coin": { "images/coin": {
"attachment": [ "attachment": [
{ "time": 0.5, "name": "images/coin-invert" } { "time": 0.5, "name": "coin-invert" }
] ]
}, },
"images/shine": { "images/shine": {
@ -130,7 +130,7 @@
"deform": { "deform": {
"default": { "default": {
"images/coin": { "images/coin": {
"images/coin": [ "coin": [
{ {
"time": 0, "time": 0,
"offset": 4, "offset": 4,
@ -149,7 +149,7 @@
"vertices": [ -123.45187, 0, 2.46911, 0, 21.49595, 0, 43.40345, 0, 62.12716, 0, 78.07299, 0, 91.54979, 0, 104.3065, 0, 113.33989, 0, 119.82108, 0, 121.96114, 0, 121.96114, 0, 115.91174, 0, 104.80113, 0, 90.69177, 0, 75.56894, 0, 57.97707, 0, 38.43056, 0, 12.3, 0, 0, 0, -123.45187, 0, 17.23255, 0, 38.38749, 0, 57.02411, 0, 72.89646, 0, 86.27205, 0, 98.25078, 0, 107.61369, 0, 114.65815, 0, 119.83006, 0, 122.0593, 0, 121.79179, 0, 118.35281, 0, 109.93669, 0, 96.26056, 0, 77.62492, 0, 59.13956, 0, 37.0473, 0, 16.90878 ] "vertices": [ -123.45187, 0, 2.46911, 0, 21.49595, 0, 43.40345, 0, 62.12716, 0, 78.07299, 0, 91.54979, 0, 104.3065, 0, 113.33989, 0, 119.82108, 0, 121.96114, 0, 121.96114, 0, 115.91174, 0, 104.80113, 0, 90.69177, 0, 75.56894, 0, 57.97707, 0, 38.43056, 0, 12.3, 0, 0, 0, -123.45187, 0, 17.23255, 0, 38.38749, 0, 57.02411, 0, 72.89646, 0, 86.27205, 0, 98.25078, 0, 107.61369, 0, 114.65815, 0, 119.83006, 0, 122.0593, 0, 121.79179, 0, 118.35281, 0, 109.93669, 0, 96.26056, 0, 77.62492, 0, 59.13956, 0, 37.0473, 0, 16.90878 ]
} }
], ],
"images/coin-invert": [ "coin-invert": [
{ {
"time": 0.5, "time": 0.5,
"vertices": [ -23.47706, 1.27002, -43.40744, 0, -59.7846, 0, -74.77602, 0, -85.79382, 0, -95.27632, 0, -102.23021, 0, -109.99683, 0, -115.50598, 0, -118.87909, 0, -121.32259, 0, -121.32259, 0, -121.32258, 0, -118.66653, 0, -114.15101, 0, -108.4615, 0, -99.61115, 0, -90.41013, 0, -79.48267, 0, -66.83928, 0, -51.93813, 0, -31.61855, 0, -19.56224, -1.52396, -12.52719, 0, 120.72772, 0, 120.72777, 0, -14.97203, 0, -28.48602, 0, -46.43241, 0, -62.14667, 0, -75.27165, 0, -86.18799, 0, -95.28229, 0, -102.08092, 0, -109.98608, 0, -115.7252, 0, -119.52184, 0, -122.15746, 0, -123.04041, 0, -122.68725, 0, -120.4799, 0, -116.33008, 0, -110.76754, 0, -103.44593, 0, -95.76433, 0, -85.61052, 0, -76.07477, 0, -64.50826, 0, -51.44074, 0, -37.66688, 0, -25.39402 ] "vertices": [ -23.47706, 1.27002, -43.40744, 0, -59.7846, 0, -74.77602, 0, -85.79382, 0, -95.27632, 0, -102.23021, 0, -109.99683, 0, -115.50598, 0, -118.87909, 0, -121.32259, 0, -121.32259, 0, -121.32258, 0, -118.66653, 0, -114.15101, 0, -108.4615, 0, -99.61115, 0, -90.41013, 0, -79.48267, 0, -66.83928, 0, -51.93813, 0, -31.61855, 0, -19.56224, -1.52396, -12.52719, 0, 120.72772, 0, 120.72777, 0, -14.97203, 0, -28.48602, 0, -46.43241, 0, -62.14667, 0, -75.27165, 0, -86.18799, 0, -95.28229, 0, -102.08092, 0, -109.98608, 0, -115.7252, 0, -119.52184, 0, -122.15746, 0, -123.04041, 0, -122.68725, 0, -120.4799, 0, -116.33008, 0, -110.76754, 0, -103.44593, 0, -95.76433, 0, -85.61052, 0, -76.07477, 0, -64.50826, 0, -51.44074, 0, -37.66688, 0, -25.39402 ]

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -69,5 +69,9 @@ module spine {
newPointAttachment(skin: Skin, name: string): PointAttachment { newPointAttachment(skin: Skin, name: string): PointAttachment {
return new PointAttachment(name); return new PointAttachment(name);
} }
newClippingAttachment(skin: Skin, name: string): ClippingAttachment {
return new ClippingAttachment(name);
}
} }
} }

View File

@ -0,0 +1,311 @@
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
* the Spine Software License Agreement), you may not (a) modify, translate,
* adapt, or develop new applications using the Spine Runtimes or otherwise
* create derivative works or improvements of the Spine Runtimes or (b) remove,
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
* or other intellectual property or proprietary rights notices on or in the
* Software, including any copy thereof. Redistributions in binary or source
* form must include this license and terms.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
module spine {
/*export class SkeletonClipping {
private decomposer = new ConvexDecomposer();
private clippingPolygon = new Array<number>();
private clipOutput = new Array<number>();
private clippedVertices = new Array<number>();
private clippedTriangles = new Array<number>();
private scratch = new Array<number>();
private clipAttachment: ClippingAttachment;
private clippingPolygons: Array<Array<number>>;
public void clipStart (Slot slot, ClippingAttachment clip) {
if (clipAttachment != null) return;
clipAttachment = clip;
int n = clip.getWorldVerticesLength();
float[] vertices = clippingPolygon.setSize(n);
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
makeClockwise(clippingPolygon);
clippingPolygons = decomposer.decompose(clippingPolygon);
for (FloatArray polygon : clippingPolygons) {
makeClockwise(polygon);
polygon.add(polygon.items[0]);
polygon.add(polygon.items[1]);
}
}
public void clipEnd (Slot slot) {
if (clipAttachment != null && clipAttachment.getEndSlot() == slot.getData()) clipEnd();
}
public void clipEnd () {
if (clipAttachment == null) return;
clipAttachment = null;
clippingPolygons = null;
clippedVertices.clear();
clippedTriangles.clear();
clippingPolygon.clear();
}
public boolean isClipping () {
return clipAttachment != null;
}
public void clipTriangles (float[] vertices, int verticesLength, short[] triangles, int trianglesLength, float[] uvs,
float light, float dark, boolean twoColor) {
FloatArray clipOutput = this.clipOutput, clippedVertices = this.clippedVertices;
ShortArray clippedTriangles = this.clippedTriangles;
Object[] polygons = clippingPolygons.items;
int polygonsCount = clippingPolygons.size;
int vertexSize = twoColor ? 6 : 5;
short index = 0;
clippedVertices.clear();
clippedTriangles.clear();
outer:
for (int i = 0; i < trianglesLength; i += 3) {
int vertexOffset = triangles[i] << 1;
float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 1] << 1;
float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
vertexOffset = triangles[i + 2] << 1;
float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
for (int p = 0; p < polygonsCount; p++) {
int s = clippedVertices.size;
if (clip(x1, y1, x2, y2, x3, y3, (FloatArray)polygons[p], clipOutput)) {
int clipOutputLength = clipOutput.size;
if (clipOutputLength == 0) continue;
float d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
float d = 1 / (d0 * d2 + d1 * (y1 - y3));
int clipOutputCount = clipOutputLength >> 1;
float[] clipOutputItems = clipOutput.items;
float[] clippedVerticesItems = clippedVertices.setSize(s + clipOutputCount * vertexSize);
for (int ii = 0; ii < clipOutputLength; ii += 2) {
float x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
clippedVerticesItems[s] = x;
clippedVerticesItems[s + 1] = y;
clippedVerticesItems[s + 2] = light;
if (twoColor) {
clippedVerticesItems[s + 3] = dark;
s += 4;
} else
s += 3;
float c0 = x - x3, c1 = y - y3;
float a = (d0 * c0 + d1 * c1) * d;
float b = (d4 * c0 + d2 * c1) * d;
float c = 1 - a - b;
clippedVerticesItems[s] = u1 * a + u2 * b + u3 * c;
clippedVerticesItems[s + 1] = v1 * a + v2 * b + v3 * c;
s += 2;
}
s = clippedTriangles.size;
short[] clippedTrianglesItems = clippedTriangles.setSize(s + 3 * (clipOutputCount - 2));
clipOutputCount--;
for (int ii = 1; ii < clipOutputCount; ii++) {
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (short)(index + ii);
clippedTrianglesItems[s + 2] = (short)(index + ii + 1);
s += 3;
}
index += clipOutputCount + 1;
} else {
float[] clippedVerticesItems = clippedVertices.setSize(s + 3 * vertexSize);
clippedVerticesItems[s] = x1;
clippedVerticesItems[s + 1] = y1;
clippedVerticesItems[s + 2] = light;
if (!twoColor) {
clippedVerticesItems[s + 3] = u1;
clippedVerticesItems[s + 4] = v1;
clippedVerticesItems[s + 5] = x2;
clippedVerticesItems[s + 6] = y2;
clippedVerticesItems[s + 7] = light;
clippedVerticesItems[s + 8] = u2;
clippedVerticesItems[s + 9] = v2;
clippedVerticesItems[s + 10] = x3;
clippedVerticesItems[s + 11] = y3;
clippedVerticesItems[s + 12] = light;
clippedVerticesItems[s + 13] = u3;
clippedVerticesItems[s + 14] = v3;
} else {
clippedVerticesItems[s + 3] = dark;
clippedVerticesItems[s + 4] = u1;
clippedVerticesItems[s + 5] = v1;
clippedVerticesItems[s + 6] = x2;
clippedVerticesItems[s + 7] = y2;
clippedVerticesItems[s + 8] = light;
clippedVerticesItems[s + 9] = dark;
clippedVerticesItems[s + 10] = u2;
clippedVerticesItems[s + 11] = v2;
clippedVerticesItems[s + 12] = x3;
clippedVerticesItems[s + 13] = y3;
clippedVerticesItems[s + 14] = light;
clippedVerticesItems[s + 15] = dark;
clippedVerticesItems[s + 16] = u3;
clippedVerticesItems[s + 17] = v3;
}
s = clippedTriangles.size;
short[] clippedTrianglesItems = clippedTriangles.setSize(s + 3);
clippedTrianglesItems[s] = index;
clippedTrianglesItems[s + 1] = (short)(index + 1);
clippedTrianglesItems[s + 2] = (short)(index + 2);
index += 3;
continue outer;
}
}
}
}
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
/*boolean clip (float x1, float y1, float x2, float y2, float x3, float y3, FloatArray clippingArea, FloatArray output) {
FloatArray originalOutput = output;
boolean clipped = false;
// Avoid copy at the end.
FloatArray input = null;
if (clippingArea.size % 4 >= 2) {
input = output;
output = scratch;
} else
input = scratch;
input.clear();
input.add(x1);
input.add(y1);
input.add(x2);
input.add(y2);
input.add(x3);
input.add(y3);
input.add(x1);
input.add(y1);
output.clear();
float[] clippingVertices = clippingArea.items;
int clippingVerticesLast = clippingArea.size - 4;
for (int i = 0;; i += 2) {
float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];
float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;
float[] inputVertices = input.items;
int inputVerticesLength = input.size - 2, outputStart = output.size;
for (int ii = 0; ii < inputVerticesLength; ii += 2) {
float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
float inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];
boolean side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;
if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) {
if (side2) { // v1 inside, v2 inside
output.add(inputX2);
output.add(inputY2);
continue;
}
// v1 inside, v2 outside
float c0 = inputY2 - inputY, c2 = inputX2 - inputX;
float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
output.add(edgeX + (edgeX2 - edgeX) * ua);
output.add(edgeY + (edgeY2 - edgeY) * ua);
} else if (side2) { // v1 outside, v2 inside
float c0 = inputY2 - inputY, c2 = inputX2 - inputX;
float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
output.add(edgeX + (edgeX2 - edgeX) * ua);
output.add(edgeY + (edgeY2 - edgeY) * ua);
output.add(inputX2);
output.add(inputY2);
}
clipped = true;
}
if (outputStart == output.size) { // All edges outside.
originalOutput.clear();
return true;
}
output.add(output.items[0]);
output.add(output.items[1]);
if (i == clippingVerticesLast) break;
FloatArray temp = output;
output = input;
output.clear();
input = temp;
}
if (originalOutput != output) {
originalOutput.clear();
originalOutput.addAll(output.items, 0, output.size - 2);
} else
originalOutput.setSize(originalOutput.size - 2);
return clipped;
}
public FloatArray getClippedVertices () {
return clippedVertices;
}
public ShortArray getClippedTriangles () {
return clippedTriangles;
}
static void makeClockwise (FloatArray polygon) {
float[] vertices = polygon.items;
int verticeslength = polygon.size;
float area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x, p1y, p2x, p2y;
for (int i = 0, n = verticeslength - 3; i < n; i += 2) {
p1x = vertices[i];
p1y = vertices[i + 1];
p2x = vertices[i + 2];
p2y = vertices[i + 3];
area += p1x * p2y - p2x * p1y;
}
if (area < 0) return;
for (int i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
float x = vertices[i], y = vertices[i + 1];
int other = lastX - i;
vertices[i] = vertices[other];
vertices[i + 1] = vertices[other + 1];
vertices[other] = x;
vertices[other + 1] = y;
}
}
}*/
}

View File

@ -209,7 +209,7 @@ module spine {
if (slotIndex == -1) throw new Error("Slot not found: " + slotName); if (slotIndex == -1) throw new Error("Slot not found: " + slotName);
let slotMap = skinMap[slotName]; let slotMap = skinMap[slotName];
for (let entryName in slotMap) { for (let entryName in slotMap) {
let attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName); let attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
if (attachment != null) skin.addAttachment(slotIndex, entryName, attachment); if (attachment != null) skin.addAttachment(slotIndex, entryName, attachment);
} }
} }
@ -253,7 +253,7 @@ module spine {
return skeletonData; return skeletonData;
} }
readAttachment (map: any, skin: Skin, slotIndex: number, name: string): Attachment { readAttachment (map: any, skin: Skin, slotIndex: number, name: string, skeletonData: SkeletonData): Attachment {
let scale = this.scale; let scale = this.scale;
name = this.getValue(map, "name", name); name = this.getValue(map, "name", name);
@ -342,6 +342,24 @@ module spine {
if (color != null) point.color.setFromString(color); if (color != null) point.color.setFromString(color);
return point; return point;
} }
case "clipping": {
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
if (clip == null) return null;
let end = this.getValue(map, "end", null);
if (end != null) {
let slot = skeletonData.findSlot(end);
if (slot == null) throw new Error("Clipping end slot not found: " + end);
clip.endSlot = slot;
}
let vertexCount = map.vertexCount;
this.readVertices(map, clip, vertexCount << 1);
let color: string = this.getValue(map, "color", null);
if (color != null) clip.color.setFromString(color);
return clip;
}
} }
return null; return null;
} }

View File

@ -44,5 +44,8 @@ module spine {
/** @return May be null to not load an attachment */ /** @return May be null to not load an attachment */
newPointAttachment(skin: Skin, name: string): PointAttachment; newPointAttachment(skin: Skin, name: string): PointAttachment;
/** @return May be null to not load an attachment */
newClippingAttachment(skin: Skin, name: string): ClippingAttachment;
} }
} }

View File

@ -0,0 +1,42 @@
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
* the Spine Software License Agreement), you may not (a) modify, translate,
* adapt, or develop new applications using the Spine Runtimes or otherwise
* create derivative works or improvements of the Spine Runtimes or (b) remove,
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
* or other intellectual property or proprietary rights notices on or in the
* Software, including any copy thereof. Redistributions in binary or source
* form must include this license and terms.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
module spine {
export class ClippingAttachment extends VertexAttachment {
endSlot: SlotData;
// Nonessential.
color = new spine.Color(0.2275, 0.2275, 0.8078, 1); // ce3a3aff
constructor (name: string) {
super(name);
}
}
}

View File

@ -1,5 +1,5 @@
{ {
"skeleton": { "hash": "rNc8k+39sqArL/posag7CkAFfTo", "spine": "3.6.14-beta", "width": 260, "height": 359.92, "images": "" }, "skeleton": { "hash": "4cI0KYdFTZbO7vkQYPFQN+yauDw", "spine": "3.6.14-beta", "width": 260, "height": 359.92, "images": "./images/" },
"bones": [ "bones": [
{ "name": "root" }, { "name": "root" },
{ "name": "coin-root", "parent": "root", "y": 300, "color": "ff0000ff" }, { "name": "coin-root", "parent": "root", "y": 300, "color": "ff0000ff" },
@ -8,9 +8,9 @@
{ "name": "shine", "parent": "coin-root", "rotation": -24.17, "scaleY": 1.478, "color": "ffffffff" } { "name": "shine", "parent": "coin-root", "rotation": -24.17, "scaleY": 1.478, "color": "ffffffff" }
], ],
"slots": [ "slots": [
{ "name": "images/coin", "bone": "coin", "attachment": "images/coin" }, { "name": "images/coin", "bone": "coin", "attachment": "coin" },
{ "name": "clipping", "bone": "clipping", "attachment": "clipping" }, { "name": "clipping", "bone": "clipping", "attachment": "clipping" },
{ "name": "images/shine", "bone": "shine", "color": "ffffff93", "attachment": "images/shine", "blend": "additive" } { "name": "images/shine", "bone": "shine", "color": "ffffff93", "attachment": "shine", "blend": "additive" }
], ],
"skins": { "skins": {
"default": { "default": {
@ -24,7 +24,7 @@
} }
}, },
"images/coin": { "images/coin": {
"images/coin": { "coin": {
"type": "mesh", "type": "mesh",
"uvs": [ 1, 1, 0.51662, 0.99661, 0.38311, 0.99567, 0.29957, 0.96664, 0.22817, 0.93237, 0.16736, 0.88777, 0.11597, 0.83202, 0.06732, 0.76058, 0.03288, 0.69072, 0.00816, 0.61391, 0, 0.52843, 0, 0.43778, 0.02307, 0.33992, 0.06544, 0.24204, 0.11924, 0.16659, 0.17691, 0.10919, 0.24399, 0.06252, 0.31853, 0.02742, 0.41818, 0.0076, 0.52609, 1.0E-5, 1, 0, 0.45994, 0.99066, 0.37873, 0.97119, 0.30719, 0.94057, 0.24626, 0.89841, 0.19491, 0.85157, 0.14893, 0.79961, 0.11299, 0.73943, 0.08595, 0.67565, 0.06609, 0.60105, 0.05753, 0.52647, 0.05856, 0.44906, 0.07176, 0.36094, 0.10407, 0.28078, 0.15657, 0.19211, 0.22811, 0.1162, 0.29907, 0.0658, 0.38388, 0.02814, 0.46119, 0.00993 ], "uvs": [ 1, 1, 0.51662, 0.99661, 0.38311, 0.99567, 0.29957, 0.96664, 0.22817, 0.93237, 0.16736, 0.88777, 0.11597, 0.83202, 0.06732, 0.76058, 0.03288, 0.69072, 0.00816, 0.61391, 0, 0.52843, 0, 0.43778, 0.02307, 0.33992, 0.06544, 0.24204, 0.11924, 0.16659, 0.17691, 0.10919, 0.24399, 0.06252, 0.31853, 0.02742, 0.41818, 0.0076, 0.52609, 1.0E-5, 1, 0, 0.45994, 0.99066, 0.37873, 0.97119, 0.30719, 0.94057, 0.24626, 0.89841, 0.19491, 0.85157, 0.14893, 0.79961, 0.11299, 0.73943, 0.08595, 0.67565, 0.06609, 0.60105, 0.05753, 0.52647, 0.05856, 0.44906, 0.07176, 0.36094, 0.10407, 0.28078, 0.15657, 0.19211, 0.22811, 0.1162, 0.29907, 0.0658, 0.38388, 0.02814, 0.46119, 0.00993 ],
"triangles": [ 38, 18, 19, 37, 17, 18, 37, 18, 38, 36, 16, 17, 36, 17, 37, 35, 15, 16, 35, 16, 36, 34, 14, 15, 34, 15, 35, 34, 33, 13, 34, 13, 14, 12, 13, 33, 32, 12, 33, 11, 12, 32, 31, 11, 32, 31, 10, 11, 30, 10, 31, 31, 33, 30, 29, 30, 33, 29, 9, 10, 29, 10, 30, 32, 33, 31, 34, 28, 29, 8, 9, 29, 8, 29, 28, 33, 34, 29, 25, 26, 27, 7, 8, 28, 7, 28, 27, 27, 28, 25, 26, 7, 27, 6, 7, 26, 34, 36, 28, 28, 36, 25, 6, 26, 25, 5, 6, 25, 34, 35, 36, 37, 24, 25, 5, 25, 24, 4, 5, 24, 36, 37, 25, 22, 23, 24, 4, 24, 23, 3, 4, 23, 24, 21, 22, 3, 23, 22, 38, 24, 37, 24, 1, 21, 2, 22, 21, 3, 22, 2, 1, 38, 19, 1, 24, 38, 2, 21, 1, 19, 20, 0, 1, 19, 0 ], "triangles": [ 38, 18, 19, 37, 17, 18, 37, 18, 38, 36, 16, 17, 36, 17, 37, 35, 15, 16, 35, 16, 36, 34, 14, 15, 34, 15, 35, 34, 33, 13, 34, 13, 14, 12, 13, 33, 32, 12, 33, 11, 12, 32, 31, 11, 32, 31, 10, 11, 30, 10, 31, 31, 33, 30, 29, 30, 33, 29, 9, 10, 29, 10, 30, 32, 33, 31, 34, 28, 29, 8, 9, 29, 8, 29, 28, 33, 34, 29, 25, 26, 27, 7, 8, 28, 7, 28, 27, 27, 28, 25, 26, 7, 27, 6, 7, 26, 34, 36, 28, 28, 36, 25, 6, 26, 25, 5, 6, 25, 34, 35, 36, 37, 24, 25, 5, 25, 24, 4, 5, 24, 36, 37, 25, 22, 23, 24, 4, 24, 23, 3, 4, 23, 24, 21, 22, 3, 23, 22, 38, 24, 37, 24, 1, 21, 2, 22, 21, 3, 22, 2, 1, 38, 19, 1, 24, 38, 2, 21, 1, 19, 20, 0, 1, 19, 0 ],
@ -34,7 +34,7 @@
"width": 259, "width": 259,
"height": 245 "height": 245
}, },
"images/coin-invert": { "coin-invert": {
"type": "mesh", "type": "mesh",
"uvs": [ 0.61921, 0.00932, 0.70137, 0.03058, 0.76675, 0.06301, 0.82357, 0.10192, 0.86533, 0.14084, 0.90128, 0.1866, 0.92763, 0.22768, 0.95707, 0.28353, 0.97795, 0.33937, 0.99074, 0.38663, 1, 0.45194, 1, 0.50671, 1, 0.56148, 0.98993, 0.62238, 0.97282, 0.6757, 0.95125, 0.73083, 0.91771, 0.78704, 0.88283, 0.83498, 0.84141, 0.87966, 0.79349, 0.91785, 0.73701, 0.95172, 0.65999, 0.98127, 0.60659, 0.991, 0.51662, 0.99661, 0, 1, 0, 0, 0.52609, 1.0E-5, 0.57849, 0.98348, 0.64806, 0.96162, 0.70899, 0.92882, 0.75987, 0.89639, 0.80219, 0.85685, 0.83745, 0.81722, 0.86381, 0.77794, 0.89445, 0.72582, 0.9167, 0.67213, 0.93142, 0.61628, 0.94164, 0.56011, 0.94506, 0.50823, 0.9437, 0.45454, 0.93514, 0.39905, 0.91905, 0.34031, 0.89748, 0.28194, 0.8691, 0.2284, 0.83932, 0.18768, 0.79995, 0.143, 0.76298, 0.10841, 0.71814, 0.07598, 0.66748, 0.04824, 0.61408, 0.0277, 0.5665, 0.01437 ], "uvs": [ 0.61921, 0.00932, 0.70137, 0.03058, 0.76675, 0.06301, 0.82357, 0.10192, 0.86533, 0.14084, 0.90128, 0.1866, 0.92763, 0.22768, 0.95707, 0.28353, 0.97795, 0.33937, 0.99074, 0.38663, 1, 0.45194, 1, 0.50671, 1, 0.56148, 0.98993, 0.62238, 0.97282, 0.6757, 0.95125, 0.73083, 0.91771, 0.78704, 0.88283, 0.83498, 0.84141, 0.87966, 0.79349, 0.91785, 0.73701, 0.95172, 0.65999, 0.98127, 0.60659, 0.991, 0.51662, 0.99661, 0, 1, 0, 0, 0.52609, 1.0E-5, 0.57849, 0.98348, 0.64806, 0.96162, 0.70899, 0.92882, 0.75987, 0.89639, 0.80219, 0.85685, 0.83745, 0.81722, 0.86381, 0.77794, 0.89445, 0.72582, 0.9167, 0.67213, 0.93142, 0.61628, 0.94164, 0.56011, 0.94506, 0.50823, 0.9437, 0.45454, 0.93514, 0.39905, 0.91905, 0.34031, 0.89748, 0.28194, 0.8691, 0.2284, 0.83932, 0.18768, 0.79995, 0.143, 0.76298, 0.10841, 0.71814, 0.07598, 0.66748, 0.04824, 0.61408, 0.0277, 0.5665, 0.01437 ],
"triangles": [ 50, 26, 0, 49, 50, 0, 48, 0, 1, 49, 0, 48, 47, 1, 2, 48, 1, 47, 46, 47, 2, 46, 2, 3, 45, 46, 3, 45, 3, 4, 44, 45, 4, 44, 4, 5, 43, 44, 5, 43, 5, 6, 42, 43, 6, 42, 6, 7, 41, 42, 7, 41, 7, 8, 40, 41, 8, 40, 8, 9, 39, 40, 9, 10, 39, 9, 39, 10, 11, 38, 39, 11, 41, 40, 38, 38, 40, 39, 38, 11, 12, 37, 38, 12, 38, 36, 41, 37, 36, 38, 13, 37, 12, 36, 37, 13, 36, 43, 41, 41, 43, 42, 14, 36, 13, 35, 36, 14, 44, 43, 36, 35, 34, 36, 15, 35, 14, 34, 35, 15, 44, 36, 45, 34, 33, 36, 16, 34, 15, 33, 34, 16, 48, 47, 49, 36, 33, 45, 17, 33, 16, 32, 33, 17, 32, 31, 33, 18, 32, 17, 31, 32, 18, 33, 29, 45, 45, 47, 46, 31, 30, 33, 19, 30, 31, 19, 31, 18, 49, 47, 45, 30, 29, 33, 20, 29, 30, 20, 30, 19, 50, 49, 29, 45, 29, 49, 21, 28, 29, 21, 29, 20, 29, 27, 50, 28, 27, 29, 22, 27, 28, 22, 28, 21, 23, 25, 26, 23, 26, 50, 23, 50, 27, 23, 27, 22, 24, 25, 23 ], "triangles": [ 50, 26, 0, 49, 50, 0, 48, 0, 1, 49, 0, 48, 47, 1, 2, 48, 1, 47, 46, 47, 2, 46, 2, 3, 45, 46, 3, 45, 3, 4, 44, 45, 4, 44, 4, 5, 43, 44, 5, 43, 5, 6, 42, 43, 6, 42, 6, 7, 41, 42, 7, 41, 7, 8, 40, 41, 8, 40, 8, 9, 39, 40, 9, 10, 39, 9, 39, 10, 11, 38, 39, 11, 41, 40, 38, 38, 40, 39, 38, 11, 12, 37, 38, 12, 38, 36, 41, 37, 36, 38, 13, 37, 12, 36, 37, 13, 36, 43, 41, 41, 43, 42, 14, 36, 13, 35, 36, 14, 44, 43, 36, 35, 34, 36, 15, 35, 14, 34, 35, 15, 44, 36, 45, 34, 33, 36, 16, 34, 15, 33, 34, 16, 48, 47, 49, 36, 33, 45, 17, 33, 16, 32, 33, 17, 32, 31, 33, 18, 32, 17, 31, 32, 18, 33, 29, 45, 45, 47, 46, 31, 30, 33, 19, 30, 31, 19, 31, 18, 49, 47, 45, 30, 29, 33, 20, 29, 30, 20, 30, 19, 50, 49, 29, 45, 29, 49, 21, 28, 29, 21, 29, 20, 29, 27, 50, 28, 27, 29, 22, 27, 28, 22, 28, 21, 23, 25, 26, 23, 26, 50, 23, 50, 27, 23, 27, 22, 24, 25, 23 ],
@ -46,7 +46,7 @@
} }
}, },
"images/shine": { "images/shine": {
"images/shine": { "width": 72, "height": 245 } "shine": { "width": 72, "height": 245 }
} }
} }
}, },
@ -55,7 +55,7 @@
"slots": { "slots": {
"images/coin": { "images/coin": {
"attachment": [ "attachment": [
{ "time": 0.5, "name": "images/coin-invert" } { "time": 0.5, "name": "coin-invert" }
] ]
}, },
"images/shine": { "images/shine": {
@ -130,7 +130,7 @@
"deform": { "deform": {
"default": { "default": {
"images/coin": { "images/coin": {
"images/coin": [ "coin": [
{ {
"time": 0, "time": 0,
"offset": 4, "offset": 4,
@ -149,7 +149,7 @@
"vertices": [ -123.45187, 0, 2.46911, 0, 21.49595, 0, 43.40345, 0, 62.12716, 0, 78.07299, 0, 91.54979, 0, 104.3065, 0, 113.33989, 0, 119.82108, 0, 121.96114, 0, 121.96114, 0, 115.91174, 0, 104.80113, 0, 90.69177, 0, 75.56894, 0, 57.97707, 0, 38.43056, 0, 12.3, 0, 0, 0, -123.45187, 0, 17.23255, 0, 38.38749, 0, 57.02411, 0, 72.89646, 0, 86.27205, 0, 98.25078, 0, 107.61369, 0, 114.65815, 0, 119.83006, 0, 122.0593, 0, 121.79179, 0, 118.35281, 0, 109.93669, 0, 96.26056, 0, 77.62492, 0, 59.13956, 0, 37.0473, 0, 16.90878 ] "vertices": [ -123.45187, 0, 2.46911, 0, 21.49595, 0, 43.40345, 0, 62.12716, 0, 78.07299, 0, 91.54979, 0, 104.3065, 0, 113.33989, 0, 119.82108, 0, 121.96114, 0, 121.96114, 0, 115.91174, 0, 104.80113, 0, 90.69177, 0, 75.56894, 0, 57.97707, 0, 38.43056, 0, 12.3, 0, 0, 0, -123.45187, 0, 17.23255, 0, 38.38749, 0, 57.02411, 0, 72.89646, 0, 86.27205, 0, 98.25078, 0, 107.61369, 0, 114.65815, 0, 119.83006, 0, 122.0593, 0, 121.79179, 0, 118.35281, 0, 109.93669, 0, 96.26056, 0, 77.62492, 0, 59.13956, 0, 37.0473, 0, 16.90878 ]
} }
], ],
"images/coin-invert": [ "coin-invert": [
{ {
"time": 0.5, "time": 0.5,
"vertices": [ -23.47706, 1.27002, -43.40744, 0, -59.7846, 0, -74.77602, 0, -85.79382, 0, -95.27632, 0, -102.23021, 0, -109.99683, 0, -115.50598, 0, -118.87909, 0, -121.32259, 0, -121.32259, 0, -121.32258, 0, -118.66653, 0, -114.15101, 0, -108.4615, 0, -99.61115, 0, -90.41013, 0, -79.48267, 0, -66.83928, 0, -51.93813, 0, -31.61855, 0, -19.56224, -1.52396, -12.52719, 0, 120.72772, 0, 120.72777, 0, -14.97203, 0, -28.48602, 0, -46.43241, 0, -62.14667, 0, -75.27165, 0, -86.18799, 0, -95.28229, 0, -102.08092, 0, -109.98608, 0, -115.7252, 0, -119.52184, 0, -122.15746, 0, -123.04041, 0, -122.68725, 0, -120.4799, 0, -116.33008, 0, -110.76754, 0, -103.44593, 0, -95.76433, 0, -85.61052, 0, -76.07477, 0, -64.50826, 0, -51.44074, 0, -37.66688, 0, -25.39402 ] "vertices": [ -23.47706, 1.27002, -43.40744, 0, -59.7846, 0, -74.77602, 0, -85.79382, 0, -95.27632, 0, -102.23021, 0, -109.99683, 0, -115.50598, 0, -118.87909, 0, -121.32259, 0, -121.32259, 0, -121.32258, 0, -118.66653, 0, -114.15101, 0, -108.4615, 0, -99.61115, 0, -90.41013, 0, -79.48267, 0, -66.83928, 0, -51.93813, 0, -31.61855, 0, -19.56224, -1.52396, -12.52719, 0, 120.72772, 0, 120.72777, 0, -14.97203, 0, -28.48602, 0, -46.43241, 0, -62.14667, 0, -75.27165, 0, -86.18799, 0, -95.28229, 0, -102.08092, 0, -109.98608, 0, -115.7252, 0, -119.52184, 0, -122.15746, 0, -123.04041, 0, -122.68725, 0, -120.4799, 0, -116.33008, 0, -110.76754, 0, -103.44593, 0, -95.76433, 0, -85.61052, 0, -76.07477, 0, -64.50826, 0, -51.44074, 0, -37.66688, 0, -25.39402 ]

View File

@ -12,7 +12,7 @@
</body> </body>
<script> <script>
var FILE = "spineboy"; var FILE = "coin";
var NUM_SKELETONS = 1; var NUM_SKELETONS = 1;
var SCALE = 0.6; var SCALE = 0.6;
@ -62,7 +62,7 @@ function load() {
stateData.defaultMix = mixDuration; stateData.defaultMix = mixDuration;
state.multipleMixing = false; state.multipleMixing = false;
state.setAnimation(0, "idle", true); state.setAnimation(0, "animation", true);
state.apply(skeleton); state.apply(skeleton);
skeleton.x = Math.random() * 200 - Math.random() * 200; skeleton.x = Math.random() * 200 - Math.random() * 200;
skeleton.y = Math.random() * 200 - Math.random() * 200; skeleton.y = Math.random() * 200 - Math.random() * 200;