├── .gitignore
├── .npmignore
├── buddy-spine
├── buddy.spine
└── ASSETS
│ ├── bg.png
│ ├── Thumbs.db
│ ├── btn_01.png
│ ├── btn_02.png
│ ├── btn_clean.png
│ ├── buddy_body.png
│ ├── buddy_eye.png
│ ├── buddy_hair.png
│ ├── buddy_head.png
│ ├── inputfield.png
│ ├── buddy_pelvis.png
│ ├── buddy_brow_left.png
│ ├── buddy_foot_left.png
│ ├── buddy_legs_full.png
│ ├── buddy_brow_right.png
│ ├── buddy_face_happy.png
│ ├── buddy_face_normal.png
│ ├── buddy_foot_right.png
│ ├── buddy_hand_right.png
│ ├── buddy_leg_left_top.png
│ ├── buddy_outfit01_tie.png
│ ├── buddy_arm_left_rest.png
│ ├── buddy_arm_right_top.png
│ ├── buddy_leg_right_top.png
│ ├── buddy_outfit02_mask.png
│ ├── buddy_outfit02_vest.png
│ ├── buddy_arm_right_bottom.png
│ ├── buddy_arm_walk_left_top.png
│ ├── buddy_leg_left_bottom.png
│ ├── buddy_leg_right_bottom.png
│ ├── buddy_outfit01_collar.png
│ ├── buddy_outfit01_glasses.png
│ ├── buddy_arm_walk_right_top.png
│ ├── buddy_arm_walk_left_bottom.png
│ └── buddy_arm_walk_right_bottom.png
├── example
├── assets
│ ├── btn_01.png
│ ├── btn_02.png
│ ├── goblins.png
│ ├── footstep.png
│ ├── spineboy.png
│ ├── spineboy-old.png
│ ├── buddy_skeleton.png
│ ├── spineboy-old.atlas
│ ├── spineboy.atlas
│ ├── buddy_skeleton.atlas
│ ├── goblins.atlas
│ ├── goblins.json
│ ├── buddy_skeleton.json
│ └── spineboy-old.json
├── spineboy-old.html
├── buddy.html
├── goblins.html
└── spineboy.html
├── config
├── typings.json
└── tslint.json
├── ts
├── definition.d.ts
├── SpineLoader.ts
├── Plugin.ts
└── Spine.ts
├── .github
└── ISSUE_TEMPLATE.md
├── LICENSE
├── package.json
├── Gruntfile.js
├── README.md
└── vendor
└── Spine.d.ts
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | .tscache
4 | .tmp.txt
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | Gruntfile.js
2 | vendor
3 | ts
4 | .idea
5 | buddy-spine
6 | .tscache
--------------------------------------------------------------------------------
/buddy-spine/buddy.spine:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/buddy.spine
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/bg.png
--------------------------------------------------------------------------------
/example/assets/btn_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/btn_01.png
--------------------------------------------------------------------------------
/example/assets/btn_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/btn_02.png
--------------------------------------------------------------------------------
/example/assets/goblins.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/goblins.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/Thumbs.db
--------------------------------------------------------------------------------
/example/assets/footstep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/footstep.png
--------------------------------------------------------------------------------
/example/assets/spineboy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/spineboy.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/btn_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/btn_01.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/btn_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/btn_02.png
--------------------------------------------------------------------------------
/example/assets/spineboy-old.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/spineboy-old.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/btn_clean.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/btn_clean.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_body.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_body.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_eye.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_hair.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_hair.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_head.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/inputfield.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/inputfield.png
--------------------------------------------------------------------------------
/example/assets/buddy_skeleton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/example/assets/buddy_skeleton.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_pelvis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_pelvis.png
--------------------------------------------------------------------------------
/config/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "phaser-spine",
3 | "main": "build/phaser-spine.d.ts",
4 | "global": true
5 | }
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_brow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_brow_left.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_foot_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_foot_left.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_legs_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_legs_full.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_brow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_brow_right.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_face_happy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_face_happy.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_face_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_face_normal.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_foot_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_foot_right.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_hand_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_hand_right.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_leg_left_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_leg_left_top.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_outfit01_tie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_outfit01_tie.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_left_rest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_left_rest.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_right_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_right_top.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_leg_right_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_leg_right_top.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_outfit02_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_outfit02_mask.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_outfit02_vest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_outfit02_vest.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_right_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_right_bottom.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_walk_left_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_walk_left_top.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_leg_left_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_leg_left_bottom.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_leg_right_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_leg_right_bottom.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_outfit01_collar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_outfit01_collar.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_outfit01_glasses.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_outfit01_glasses.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_walk_right_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_walk_right_top.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_walk_left_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_walk_left_bottom.png
--------------------------------------------------------------------------------
/buddy-spine/ASSETS/buddy_arm_walk_right_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-spine/HEAD/buddy-spine/ASSETS/buddy_arm_walk_right_bottom.png
--------------------------------------------------------------------------------
/ts/definition.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Before opening this issue _please_ check we haven't already fixed it! Check the [Closed issues](https://github.com/azerion/phaser-spine/issues?q=is%3Aissue+is%3Aclosed)
2 | This Issue is about (delete as applicable)
3 |
4 | * A bug in the API (always say which version you're using!)
5 | * An error in the documentation
6 | * An error in the example
7 | * A problem with my own code
8 |
9 | API errors must include example code showing what happens, and why you don't believe this is the expected behavior. Also mention the Phaser version you're using for your project. Issues posted without code take _far_ longer to get resolved, _if ever_.
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Azerion
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@azerion/phaser-spine",
3 | "author": "Azerion",
4 | "version": "3.0.10",
5 | "description": "Spine plugin for Phaser.io!",
6 | "contributors": [
7 | {
8 | "name": "Ale Bles",
9 | "email": "a.bles@azerion.com"
10 | }
11 | ],
12 | "repository": {
13 | "type": "git",
14 | "url": "git@github.com:azerion/phaser-spine.git"
15 | },
16 | "licenses": [
17 | {
18 | "type": "MIT",
19 | "url": "https://raw.githubusercontent.com/azerion/phaser-spine/master/LICENSE"
20 | }
21 | ],
22 | "bugs": [
23 | {
24 | "url": "https://github.com/azerion/phaser-spine/issues"
25 | }
26 | ],
27 | "config": {
28 | "name": "phaser-spine"
29 | },
30 | "devDependencies": {
31 | "grunt": "1.0.x",
32 | "grunt-banner": "^0.6.0",
33 | "grunt-contrib-clean": "1.0.x",
34 | "grunt-contrib-concat": "1.0.x",
35 | "grunt-contrib-connect": "1.0.x",
36 | "grunt-contrib-uglify": "2.0.x",
37 | "grunt-contrib-watch": "1.0.x",
38 | "grunt-ts": "^6.0.0-beta.3",
39 | "phaser": "2.6.2",
40 | "typescript": "2.1.x"
41 | },
42 | "typings": "./config/typings.json"
43 | }
44 |
--------------------------------------------------------------------------------
/example/spineboy-old.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Phaser Spine Example
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ts/SpineLoader.ts:
--------------------------------------------------------------------------------
1 | module PhaserSpine {
2 | /**
3 | * Supporting class to load images from spine atlases as per spine spec.
4 | *
5 | * @class SpineTextureLoader
6 | * @uses EventTarget
7 | * @constructor
8 | * @param basePath {String} Tha base path where to look for the images to be loaded
9 | * @param crossorigin {Boolean} Whether requests should be treated as crossorigin
10 | */
11 | export class SpineTextureLoader {
12 | private game: Phaser.Game;
13 |
14 | constructor(game: Phaser.Game) {
15 | this.game = game;
16 | }
17 |
18 | /**
19 | * Starts loading a base texture as per spine specification
20 | *
21 | * @method load
22 | * @param page {spine.AtlasPage} Atlas page to which texture belongs
23 | * @param file {String} The file to load, this is just the file path relative to the base path configured in the constructor
24 | */
25 | public load = function (page: any, file: string, atlas: spine.Atlas) {
26 | var image = this.game.make.image(0, 0, file);
27 |
28 | page.rendererObject = image.texture.baseTexture;
29 | };
30 |
31 | /**
32 | * Unloads a previously loaded texture as per spine specification
33 | *
34 | * @method unload
35 | * @param texture {BaseTexture} Texture object to destroy
36 | */
37 | public unload = function (texture: PIXI.BaseTexture) {
38 | texture.destroy();
39 | };
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/example/buddy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Phaser Spine Example
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/example/goblins.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Phaser Spine Example
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/example/spineboy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Phaser Spine Example
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/example/assets/spineboy-old.atlas:
--------------------------------------------------------------------------------
1 | spineboy-old.png
2 | format: RGBA8888
3 | filter: Linear,Linear
4 | repeat: none
5 | eyes-closed
6 | rotate: false
7 | xy: 73, 509
8 | size: 34, 27
9 | orig: 34, 27
10 | offset: 0, 0
11 | index: -1
12 | eyes
13 | rotate: false
14 | xy: 75, 464
15 | size: 34, 27
16 | orig: 34, 27
17 | offset: 0, 0
18 | index: -1
19 | head
20 | rotate: false
21 | xy: 2, 2
22 | size: 121, 132
23 | orig: 121, 132
24 | offset: 0, 0
25 | index: -1
26 | left-ankle
27 | rotate: false
28 | xy: 96, 351
29 | size: 25, 32
30 | orig: 25, 32
31 | offset: 0, 0
32 | index: -1
33 | left-arm
34 | rotate: false
35 | xy: 39, 423
36 | size: 35, 29
37 | orig: 35, 29
38 | offset: 0, 0
39 | index: -1
40 | left-foot
41 | rotate: false
42 | xy: 2, 262
43 | size: 65, 30
44 | orig: 65, 30
45 | offset: 0, 0
46 | index: -1
47 | left-hand
48 | rotate: false
49 | xy: 2, 423
50 | size: 35, 38
51 | orig: 35, 38
52 | offset: 0, 0
53 | index: -1
54 | left-lower-leg
55 | rotate: false
56 | xy: 72, 202
57 | size: 49, 64
58 | orig: 49, 64
59 | offset: 0, 0
60 | index: -1
61 | left-pant-bottom
62 | rotate: false
63 | xy: 2, 363
64 | size: 44, 22
65 | orig: 44, 22
66 | offset: 0, 0
67 | index: -1
68 | left-shoulder
69 | rotate: false
70 | xy: 39, 454
71 | size: 34, 53
72 | orig: 34, 53
73 | offset: 0, 0
74 | index: -1
75 | left-upper-leg
76 | rotate: false
77 | xy: 2, 464
78 | size: 33, 67
79 | orig: 33, 67
80 | offset: 0, 0
81 | index: -1
82 | neck
83 | rotate: false
84 | xy: 37, 509
85 | size: 34, 28
86 | orig: 34, 28
87 | offset: 0, 0
88 | index: -1
89 | pelvis
90 | rotate: false
91 | xy: 2, 294
92 | size: 63, 47
93 | orig: 63, 47
94 | offset: 0, 0
95 | index: -1
96 | right-ankle
97 | rotate: false
98 | xy: 96, 385
99 | size: 25, 30
100 | orig: 25, 30
101 | offset: 0, 0
102 | index: -1
103 | right-arm
104 | rotate: false
105 | xy: 96, 417
106 | size: 21, 45
107 | orig: 21, 45
108 | offset: 0, 0
109 | index: -1
110 | right-foot-idle
111 | rotate: false
112 | xy: 69, 268
113 | size: 53, 28
114 | orig: 53, 28
115 | offset: 0, 0
116 | index: -1
117 | right-foot
118 | rotate: false
119 | xy: 2, 230
120 | size: 67, 30
121 | orig: 67, 30
122 | offset: 0, 0
123 | index: -1
124 | right-hand
125 | rotate: false
126 | xy: 2, 387
127 | size: 32, 32
128 | orig: 32, 32
129 | offset: 0, 0
130 | index: -1
131 | right-lower-leg
132 | rotate: false
133 | xy: 72, 136
134 | size: 51, 64
135 | orig: 51, 64
136 | offset: 0, 0
137 | index: -1
138 | right-pant-bottom
139 | rotate: false
140 | xy: 2, 343
141 | size: 46, 18
142 | orig: 46, 18
143 | offset: 0, 0
144 | index: -1
145 | right-shoulder
146 | rotate: false
147 | xy: 67, 298
148 | size: 52, 51
149 | orig: 52, 51
150 | offset: 0, 0
151 | index: -1
152 | right-upper-leg
153 | rotate: false
154 | xy: 50, 351
155 | size: 44, 70
156 | orig: 44, 70
157 | offset: 0, 0
158 | index: -1
159 | torso
160 | rotate: false
161 | xy: 2, 136
162 | size: 68, 92
163 | orig: 68, 92
164 | offset: 0, 0
165 | index: -1
166 |
--------------------------------------------------------------------------------
/config/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "align": [
4 | true,
5 | "parameters",
6 | "statements"
7 | ],
8 | "ban": false,
9 | "class-name": true,
10 | "curly": true,
11 | "eofline": true,
12 | "forin": true,
13 | "indent": [
14 | true,
15 | "spaces"
16 | ],
17 | "interface-name": true,
18 | "jsdoc-format": true,
19 | "label-position": true,
20 | "label-undefined": true,
21 | "max-line-length": [
22 | true,
23 | 200
24 | ],
25 | "member-access": true,
26 | "no-any": false,
27 | "no-arg": true,
28 | "no-conditional-assignment": true,
29 | "no-consecutive-blank-lines": true,
30 | "no-console": [
31 | true,
32 | "debug",
33 | "info",
34 | "time",
35 | "timeEnd",
36 | "trace"
37 | ],
38 | "no-construct": true,
39 | "no-constructor-vars": true,
40 | "no-debugger": true,
41 | "no-duplicate-key": true,
42 | "no-duplicate-variable": true,
43 | "no-empty": true,
44 | "no-eval": true,
45 | "no-inferrable-types": false,
46 | "no-internal-module": false,
47 | "no-null-keyword": false,
48 | "no-require-imports": true,
49 | "no-shadowed-variable": true,
50 | "no-string-literal": false,
51 | "no-switch-case-fall-through": true,
52 | "no-trailing-whitespace": true,
53 | "no-unreachable": true,
54 | "no-unused-expression": true,
55 | "no-unused-variable": true,
56 | "no-use-before-declare": true,
57 | "no-var-keyword": true,
58 | "no-var-requires": true,
59 | "object-literal-sort-keys": false,
60 | "one-line": [
61 | true,
62 | "check-open-brace",
63 | "check-catch",
64 | "check-else",
65 | "check-finally",
66 | "check-whitespace"
67 | ],
68 | "quotemark": [
69 | true,
70 | "single",
71 | "avoid-escape"
72 | ],
73 | "radix": true,
74 | "semicolon": [
75 | true,
76 | "always"
77 | ],
78 | "switch-default": true,
79 | "trailing-comma": [
80 | true,
81 | {
82 | "multiline": "never",
83 | "singleline": "never"
84 | }
85 | ],
86 | "triple-equals": [
87 | true,
88 | "allow-null-check"
89 | ],
90 | "typedef": [
91 | true,
92 | "call-signature",
93 | "parameter",
94 | "arrow-parameter",
95 | "property-declaration",
96 | "variable-declaration",
97 | "member-variable-declaration"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | },
108 | {
109 | "call-signature": "onespace",
110 | "index-signature": "onespace",
111 | "parameter": "onespace",
112 | "property-declaration": "onespace",
113 | "variable-declaration": "onespace"
114 | }
115 | ],
116 | "use-strict": false,
117 | "variable-name": [
118 | true,
119 | "allow-leading-underscore",
120 | "ban-keywords"
121 | ],
122 | "whitespace": [
123 | true,
124 | "check-branch",
125 | "check-decl",
126 | "check-operator",
127 | "check-separator",
128 | "check-type"
129 | ]
130 | }
131 | }
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function (grunt) {
2 | 'use strict';
3 |
4 | grunt.initConfig({
5 | //Get some details from the package.json
6 | pkg: grunt.file.readJSON('package.json'),
7 | banner: '/*!\n' +
8 | ' * <%= pkg.config.name %> - version <%= pkg.version %> \n' +
9 | ' * <%= pkg.description %>\n' +
10 | ' *\n' +
11 | ' * <%= pkg.author %>\n' +
12 | ' * Build at <%= grunt.template.today("dd-mm-yyyy") %>\n' +
13 | ' * Released under MIT License \n' +
14 | ' */\n',
15 | usebanner: {
16 | dist: {
17 | options: {
18 | position: 'top',
19 | banner: '<%= banner %>'
20 | },
21 | files: {
22 | src: [ 'build/*.js' ]
23 | }
24 | }
25 | },
26 | //Typescript settings per build
27 | ts: {
28 | options: {
29 | module: 'amd',
30 | target: 'es5',
31 | sourceMap: true,
32 | declaration: true,
33 | noImplicitAny: true
34 | },
35 | dist: {
36 | src: ['ts/**/*.ts'],
37 | dest: 'build/<%= pkg.config.name %>.js'
38 | }
39 | },
40 | watch: {
41 | files: ['ts/**/*.ts'],
42 | tasks: ['dist'],
43 | options: {
44 | livereload: true
45 | }
46 | },
47 | connect: {
48 | server: {
49 | options: {
50 | port: 8080
51 | }
52 | }
53 | },
54 | uglify: {
55 | options: {
56 | compress: {
57 | sequences: true,
58 | dead_code: true,
59 | conditionals: true,
60 | booleans: true,
61 | unused: true,
62 | if_return: true,
63 | join_vars: true,
64 | drop_console: true
65 | },
66 | mangle: true,
67 | beautify: false
68 | },
69 | dist: {
70 | files: {
71 | 'build/<%= pkg.config.name %>.min.js': [
72 | 'vendor/Spine.js',
73 | 'build/<%= pkg.config.name %>.js'
74 | ]
75 | }
76 | }
77 | },
78 | concat: {
79 | definitions: {
80 | src: ['build/phaser-spine.d.ts', 'vendor/Spine.d.ts'],
81 | dest: 'build/phaser-spine.d.ts'
82 | },
83 | dist: {
84 | src: ['vendor/Spine.js', 'build/phaser-spine.js'],
85 | dest: 'build/phaser-spine.js'
86 | }
87 | },
88 | clean: {
89 | dist: ['build']
90 | }
91 | });
92 |
93 | grunt.loadNpmTasks('grunt-contrib-clean');
94 | grunt.loadNpmTasks('grunt-contrib-uglify');
95 | grunt.loadNpmTasks('grunt-contrib-concat');
96 | grunt.loadNpmTasks('grunt-banner');
97 | grunt.loadNpmTasks('grunt-ts');
98 | grunt.loadNpmTasks('grunt-contrib-connect');
99 | grunt.loadNpmTasks('grunt-contrib-watch');
100 |
101 | //dist Build
102 | grunt.registerTask('dist', [
103 | 'clean:dist', //Clean the dist folder
104 | 'ts:dist',//Run typescript on the preprocessed files, for dist (client)
105 | 'uglify:dist', //Minify everything
106 | 'concat',
107 | 'usebanner:dist' //Minify everything
108 | ]);
109 |
110 | grunt.registerTask('dev', [
111 | 'dist',
112 | 'connect',
113 | 'watch'
114 | ]);
115 |
116 | };
117 |
--------------------------------------------------------------------------------
/example/assets/spineboy.atlas:
--------------------------------------------------------------------------------
1 |
2 | spineboy.png
3 | size: 1024,1024
4 | format: RGBA8888
5 | filter: Linear,Linear
6 | repeat: none
7 | eye_indifferent
8 | rotate: true
9 | xy: 648, 629
10 | size: 93, 89
11 | orig: 93, 89
12 | offset: 0, 0
13 | index: -1
14 | eye_surprised
15 | rotate: true
16 | xy: 233, 179
17 | size: 93, 89
18 | orig: 93, 89
19 | offset: 0, 0
20 | index: -1
21 | front_bracer
22 | rotate: false
23 | xy: 245, 2
24 | size: 58, 80
25 | orig: 58, 80
26 | offset: 0, 0
27 | index: -1
28 | front_fist_closed
29 | rotate: false
30 | xy: 168, 45
31 | size: 75, 82
32 | orig: 75, 82
33 | offset: 0, 0
34 | index: -1
35 | front_fist_open
36 | rotate: false
37 | xy: 844, 646
38 | size: 86, 87
39 | orig: 86, 87
40 | offset: 0, 0
41 | index: -1
42 | front_foot
43 | rotate: true
44 | xy: 310, 326
45 | size: 126, 69
46 | orig: 126, 69
47 | offset: 0, 0
48 | index: -1
49 | front_foot_bend1
50 | rotate: true
51 | xy: 951, 894
52 | size: 128, 70
53 | orig: 128, 70
54 | offset: 0, 0
55 | index: -1
56 | front_foot_bend2
57 | rotate: false
58 | xy: 2, 33
59 | size: 108, 93
60 | orig: 108, 93
61 | offset: 0, 0
62 | index: -1
63 | front_shin
64 | rotate: true
65 | xy: 739, 735
66 | size: 82, 184
67 | orig: 82, 184
68 | offset: 0, 0
69 | index: -1
70 | front_thigh
71 | rotate: false
72 | xy: 381, 340
73 | size: 48, 112
74 | orig: 48, 112
75 | offset: 0, 0
76 | index: -1
77 | front_upper_arm
78 | rotate: false
79 | xy: 112, 29
80 | size: 54, 97
81 | orig: 54, 97
82 | offset: 0, 0
83 | index: -1
84 | goggles
85 | rotate: false
86 | xy: 156, 454
87 | size: 261, 166
88 | orig: 261, 166
89 | offset: 0, 0
90 | index: -1
91 | gun
92 | rotate: false
93 | xy: 739, 819
94 | size: 210, 203
95 | orig: 210, 203
96 | offset: 0, 0
97 | index: -1
98 | head
99 | rotate: false
100 | xy: 466, 724
101 | size: 271, 298
102 | orig: 271, 298
103 | offset: 0, 0
104 | index: -1
105 | hoverboard_board
106 | rotate: true
107 | xy: 2, 128
108 | size: 492, 152
109 | orig: 492, 152
110 | offset: 0, 0
111 | index: -1
112 | hoverboard_thruster
113 | rotate: false
114 | xy: 602, 558
115 | size: 60, 64
116 | orig: 60, 64
117 | offset: 0, 0
118 | index: -1
119 | hoverglow_small
120 | rotate: true
121 | xy: 156, 178
122 | size: 274, 75
123 | orig: 274, 75
124 | offset: 0, 0
125 | index: -1
126 | mouth_grind
127 | rotate: true
128 | xy: 951, 799
129 | size: 93, 59
130 | orig: 93, 59
131 | offset: 0, 0
132 | index: -1
133 | mouth_oooo
134 | rotate: true
135 | xy: 245, 84
136 | size: 93, 59
137 | orig: 93, 59
138 | offset: 0, 0
139 | index: -1
140 | mouth_smile
141 | rotate: false
142 | xy: 925, 738
143 | size: 93, 59
144 | orig: 93, 59
145 | offset: 0, 0
146 | index: -1
147 | muzzle
148 | rotate: false
149 | xy: 2, 622
150 | size: 462, 400
151 | orig: 462, 400
152 | offset: 0, 0
153 | index: -1
154 | neck
155 | rotate: false
156 | xy: 168, 2
157 | size: 36, 41
158 | orig: 36, 41
159 | offset: 0, 0
160 | index: -1
161 | rear_bracer
162 | rotate: false
163 | xy: 932, 664
164 | size: 56, 72
165 | orig: 56, 72
166 | offset: 0, 0
167 | index: -1
168 | rear_foot
169 | rotate: false
170 | xy: 487, 562
171 | size: 113, 60
172 | orig: 113, 60
173 | offset: 0, 0
174 | index: -1
175 | rear_foot_bend1
176 | rotate: true
177 | xy: 419, 503
178 | size: 117, 66
179 | orig: 117, 66
180 | offset: 0, 0
181 | index: -1
182 | rear_foot_bend2
183 | rotate: false
184 | xy: 739, 650
185 | size: 103, 83
186 | orig: 103, 83
187 | offset: 0, 0
188 | index: -1
189 | rear_shin
190 | rotate: false
191 | xy: 233, 274
192 | size: 75, 178
193 | orig: 75, 178
194 | offset: 0, 0
195 | index: -1
196 | rear_thigh
197 | rotate: true
198 | xy: 487, 495
199 | size: 65, 104
200 | orig: 65, 104
201 | offset: 0, 0
202 | index: -1
203 | rear_upper_arm
204 | rotate: true
205 | xy: 156, 129
206 | size: 47, 87
207 | orig: 47, 87
208 | offset: 0, 0
209 | index: -1
210 | torso
211 | rotate: true
212 | xy: 466, 624
213 | size: 98, 180
214 | orig: 98, 180
215 | offset: 0, 0
216 | index: -1
217 |
--------------------------------------------------------------------------------
/example/assets/buddy_skeleton.atlas:
--------------------------------------------------------------------------------
1 |
2 | buddy_skeleton.png
3 | size: 1024,1024
4 | format: RGBA8888
5 | filter: Linear,Linear
6 | repeat: none
7 | bg
8 | rotate: false
9 | xy: 2, 412
10 | size: 800, 600
11 | orig: 800, 600
12 | offset: 0, 0
13 | index: -1
14 | buddy_arm_left_rest
15 | rotate: true
16 | xy: 134, 363
17 | size: 47, 153
18 | orig: 47, 153
19 | offset: 0, 0
20 | index: -1
21 | buddy_arm_right_bottom
22 | rotate: true
23 | xy: 481, 375
24 | size: 35, 54
25 | orig: 35, 54
26 | offset: 0, 0
27 | index: -1
28 | buddy_arm_right_top
29 | rotate: true
30 | xy: 361, 362
31 | size: 48, 57
32 | orig: 48, 57
33 | offset: 0, 0
34 | index: -1
35 | buddy_arm_walk_left_bottom
36 | rotate: false
37 | xy: 2, 35
38 | size: 46, 77
39 | orig: 46, 77
40 | offset: 0, 0
41 | index: -1
42 | buddy_arm_walk_left_top
43 | rotate: false
44 | xy: 281, 287
45 | size: 37, 74
46 | orig: 37, 74
47 | offset: 0, 0
48 | index: -1
49 | buddy_arm_walk_right_bottom
50 | rotate: true
51 | xy: 289, 363
52 | size: 47, 70
53 | orig: 47, 70
54 | offset: 0, 0
55 | index: -1
56 | buddy_arm_walk_right_top
57 | rotate: true
58 | xy: 870, 882
59 | size: 14, 78
60 | orig: 14, 78
61 | offset: 0, 0
62 | index: -1
63 | buddy_body
64 | rotate: false
65 | xy: 804, 871
66 | size: 64, 141
67 | orig: 64, 141
68 | offset: 0, 0
69 | index: -1
70 | buddy_brow_left
71 | rotate: false
72 | xy: 957, 904
73 | size: 29, 18
74 | orig: 29, 18
75 | offset: 0, 0
76 | index: -1
77 | buddy_brow_right
78 | rotate: true
79 | xy: 50, 94
80 | size: 18, 13
81 | orig: 18, 13
82 | offset: 0, 0
83 | index: -1
84 | buddy_eye
85 | rotate: true
86 | xy: 281, 278
87 | size: 7, 16
88 | orig: 7, 16
89 | offset: 0, 0
90 | index: -1
91 | buddy_face_happy
92 | rotate: true
93 | xy: 420, 374
94 | size: 36, 59
95 | orig: 36, 59
96 | offset: 0, 0
97 | index: -1
98 | buddy_face_normal
99 | rotate: true
100 | xy: 537, 379
101 | size: 31, 56
102 | orig: 31, 56
103 | offset: 0, 0
104 | index: -1
105 | buddy_foot_left
106 | rotate: true
107 | xy: 804, 642
108 | size: 67, 28
109 | orig: 67, 28
110 | offset: 0, 0
111 | index: -1
112 | buddy_foot_right
113 | rotate: true
114 | xy: 320, 299
115 | size: 62, 28
116 | orig: 62, 28
117 | offset: 0, 0
118 | index: -1
119 | buddy_hair
120 | rotate: true
121 | xy: 211, 271
122 | size: 90, 68
123 | orig: 90, 68
124 | offset: 0, 0
125 | index: -1
126 | buddy_hand_right
127 | rotate: false
128 | xy: 957, 924
129 | size: 60, 46
130 | orig: 60, 46
131 | offset: 0, 0
132 | index: -1
133 | buddy_head
134 | rotate: false
135 | xy: 134, 263
136 | size: 75, 98
137 | orig: 75, 98
138 | offset: 0, 0
139 | index: -1
140 | buddy_leg_left_bottom
141 | rotate: false
142 | xy: 804, 789
143 | size: 58, 80
144 | orig: 58, 80
145 | offset: 0, 0
146 | index: -1
147 | buddy_leg_left_top
148 | rotate: false
149 | xy: 841, 726
150 | size: 17, 61
151 | orig: 17, 61
152 | offset: 0, 0
153 | index: -1
154 | buddy_leg_right_bottom
155 | rotate: false
156 | xy: 804, 711
157 | size: 35, 76
158 | orig: 35, 76
159 | offset: 0, 0
160 | index: -1
161 | buddy_leg_right_top
162 | rotate: true
163 | xy: 957, 972
164 | size: 40, 65
165 | orig: 40, 65
166 | offset: 0, 0
167 | index: -1
168 | buddy_legs_full
169 | rotate: false
170 | xy: 2, 260
171 | size: 130, 150
172 | orig: 130, 150
173 | offset: 0, 0
174 | index: -1
175 | buddy_outfit01_collar
176 | rotate: false
177 | xy: 2, 2
178 | size: 35, 31
179 | orig: 35, 31
180 | offset: 0, 0
181 | index: -1
182 | buddy_outfit01_glasses
183 | rotate: true
184 | xy: 98, 180
185 | size: 78, 28
186 | orig: 78, 28
187 | offset: 0, 0
188 | index: -1
189 | buddy_outfit01_tie
190 | rotate: false
191 | xy: 65, 168
192 | size: 31, 90
193 | orig: 31, 90
194 | offset: 0, 0
195 | index: -1
196 | buddy_outfit02_mask
197 | rotate: false
198 | xy: 870, 898
199 | size: 85, 114
200 | orig: 85, 114
201 | offset: 0, 0
202 | index: -1
203 | buddy_outfit02_vest
204 | rotate: false
205 | xy: 2, 114
206 | size: 61, 144
207 | orig: 61, 144
208 | offset: 0, 0
209 | index: -1
210 | buddy_pelvis
211 | rotate: true
212 | xy: 65, 133
213 | size: 33, 21
214 | orig: 33, 21
215 | offset: 0, 0
216 | index: -1
217 |
--------------------------------------------------------------------------------
/example/assets/goblins.atlas:
--------------------------------------------------------------------------------
1 |
2 | goblins.png
3 | format: RGBA8888
4 | filter: Linear,Linear
5 | repeat: none
6 | dagger
7 | rotate: true
8 | xy: 372, 100
9 | size: 26, 108
10 | orig: 26, 108
11 | offset: 0, 0
12 | index: -1
13 | goblin/eyes-closed
14 | rotate: false
15 | xy: 359, 6
16 | size: 34, 12
17 | orig: 34, 12
18 | offset: 0, 0
19 | index: -1
20 | goblin/head
21 | rotate: false
22 | xy: 107, 38
23 | size: 103, 64
24 | orig: 103, 66
25 | offset: 0, 0
26 | index: -1
27 | goblin/left-arm
28 | rotate: false
29 | xy: 903, 56
30 | size: 37, 35
31 | orig: 37, 35
32 | offset: 0, 0
33 | index: -1
34 | goblin/left-foot
35 | rotate: false
36 | xy: 729, 58
37 | size: 65, 31
38 | orig: 65, 31
39 | offset: 0, 0
40 | index: -1
41 | goblin/left-hand
42 | rotate: true
43 | xy: 316, 2
44 | size: 36, 41
45 | orig: 36, 41
46 | offset: 0, 0
47 | index: -1
48 | goblin/left-lower-leg
49 | rotate: true
50 | xy: 172, 2
51 | size: 30, 70
52 | orig: 33, 70
53 | offset: 2, 0
54 | index: -1
55 | goblin/left-shoulder
56 | rotate: true
57 | xy: 857, 62
58 | size: 29, 44
59 | orig: 29, 44
60 | offset: 0, 0
61 | index: -1
62 | goblin/left-upper-leg
63 | rotate: true
64 | xy: 654, 56
65 | size: 33, 73
66 | orig: 33, 73
67 | offset: 0, 0
68 | index: -1
69 | goblin/neck
70 | rotate: true
71 | xy: 509, 22
72 | size: 36, 41
73 | orig: 36, 41
74 | offset: 0, 0
75 | index: -1
76 | goblin/pelvis
77 | rotate: true
78 | xy: 310, 40
79 | size: 62, 43
80 | orig: 62, 43
81 | offset: 0, 0
82 | index: -1
83 | goblin/right-arm
84 | rotate: false
85 | xy: 552, 8
86 | size: 23, 50
87 | orig: 23, 50
88 | offset: 0, 0
89 | index: -1
90 | goblin/right-foot
91 | rotate: false
92 | xy: 882, 93
93 | size: 63, 33
94 | orig: 63, 33
95 | offset: 0, 0
96 | index: -1
97 | goblin/right-hand
98 | rotate: false
99 | xy: 942, 54
100 | size: 36, 37
101 | orig: 36, 37
102 | offset: 0, 0
103 | index: -1
104 | goblin/right-lower-leg
105 | rotate: true
106 | xy: 654, 91
107 | size: 35, 76
108 | orig: 36, 76
109 | offset: 1, 0
110 | index: -1
111 | goblin/right-shoulder
112 | rotate: false
113 | xy: 424, 20
114 | size: 39, 42
115 | orig: 39, 45
116 | offset: 0, 0
117 | index: -1
118 | goblin/right-upper-leg
119 | rotate: true
120 | xy: 107, 2
121 | size: 34, 63
122 | orig: 34, 63
123 | offset: 0, 0
124 | index: -1
125 | goblin/torso
126 | rotate: true
127 | xy: 212, 34
128 | size: 68, 96
129 | orig: 68, 96
130 | offset: 0, 0
131 | index: -1
132 | goblin/undie-straps
133 | rotate: false
134 | xy: 2, 2
135 | size: 55, 19
136 | orig: 55, 19
137 | offset: 0, 0
138 | index: -1
139 | goblin/undies
140 | rotate: true
141 | xy: 768, 20
142 | size: 36, 29
143 | orig: 36, 29
144 | offset: 0, 0
145 | index: -1
146 | goblingirl/eyes-closed
147 | rotate: false
148 | xy: 59, 6
149 | size: 37, 15
150 | orig: 37, 21
151 | offset: 0, 0
152 | index: -1
153 | goblingirl/head
154 | rotate: false
155 | xy: 2, 23
156 | size: 103, 79
157 | orig: 103, 81
158 | offset: 0, 2
159 | index: -1
160 | goblingirl/left-arm
161 | rotate: true
162 | xy: 980, 56
163 | size: 37, 35
164 | orig: 37, 35
165 | offset: 0, 0
166 | index: -1
167 | goblingirl/left-foot
168 | rotate: false
169 | xy: 947, 95
170 | size: 65, 31
171 | orig: 65, 31
172 | offset: 0, 0
173 | index: -1
174 | goblingirl/left-hand
175 | rotate: false
176 | xy: 577, 14
177 | size: 35, 40
178 | orig: 35, 40
179 | offset: 0, 0
180 | index: -1
181 | goblingirl/left-lower-leg
182 | rotate: true
183 | xy: 244, 2
184 | size: 30, 70
185 | orig: 33, 70
186 | offset: 2, 0
187 | index: -1
188 | goblingirl/left-shoulder
189 | rotate: true
190 | xy: 810, 63
191 | size: 28, 45
192 | orig: 28, 46
193 | offset: 0, 1
194 | index: -1
195 | goblingirl/left-upper-leg
196 | rotate: true
197 | xy: 810, 93
198 | size: 33, 70
199 | orig: 33, 70
200 | offset: 0, 0
201 | index: -1
202 | goblingirl/neck
203 | rotate: true
204 | xy: 614, 21
205 | size: 33, 41
206 | orig: 35, 41
207 | offset: 0, 0
208 | index: -1
209 | goblingirl/pelvis
210 | rotate: false
211 | xy: 355, 55
212 | size: 59, 43
213 | orig: 62, 43
214 | offset: 1, 0
215 | index: -1
216 | goblingirl/right-arm
217 | rotate: true
218 | xy: 657, 11
219 | size: 22, 50
220 | orig: 28, 50
221 | offset: 3, 0
222 | index: -1
223 | goblingirl/right-foot
224 | rotate: false
225 | xy: 359, 20
226 | size: 63, 33
227 | orig: 63, 33
228 | offset: 0, 0
229 | index: -1
230 | goblingirl/right-hand
231 | rotate: true
232 | xy: 729, 21
233 | size: 35, 37
234 | orig: 36, 37
235 | offset: 1, 0
236 | index: -1
237 | goblingirl/right-lower-leg
238 | rotate: true
239 | xy: 732, 91
240 | size: 35, 76
241 | orig: 36, 76
242 | offset: 1, 0
243 | index: -1
244 | goblingirl/right-shoulder
245 | rotate: true
246 | xy: 465, 19
247 | size: 39, 42
248 | orig: 39, 45
249 | offset: 0, 0
250 | index: -1
251 | goblingirl/right-upper-leg
252 | rotate: true
253 | xy: 416, 64
254 | size: 34, 63
255 | orig: 34, 63
256 | offset: 0, 0
257 | index: -1
258 | goblingirl/torso
259 | rotate: true
260 | xy: 482, 60
261 | size: 66, 96
262 | orig: 68, 96
263 | offset: 0, 0
264 | index: -1
265 | goblingirl/undie-straps
266 | rotate: false
267 | xy: 657, 35
268 | size: 55, 19
269 | orig: 55, 19
270 | offset: 0, 0
271 | index: -1
272 | goblingirl/undies
273 | rotate: false
274 | xy: 799, 32
275 | size: 36, 29
276 | orig: 36, 29
277 | offset: 0, 0
278 | index: -1
279 | shield
280 | rotate: true
281 | xy: 580, 56
282 | size: 70, 72
283 | orig: 70, 72
284 | offset: 0, 0
285 | index: -1
286 | spear
287 | rotate: true
288 | xy: 2, 104
289 | size: 22, 368
290 | orig: 22, 368
291 | offset: 0, 0
292 | index: -1
293 |
--------------------------------------------------------------------------------
/ts/Plugin.ts:
--------------------------------------------------------------------------------
1 |
2 | module PhaserSpine {
3 | export interface SpineObjectFactory extends Phaser.GameObjectFactory {
4 | spine: (x: number, y: number, key: string, scalingVariant?: string, group?: Phaser.Group) => PhaserSpine.Spine;
5 | }
6 |
7 | export interface SpineObjectCreator extends Phaser.GameObjectCreator {
8 | spine: (x: number, y: number, key: string, scalingVariant?: string, group?: Phaser.Group) => PhaserSpine.Spine;
9 | }
10 |
11 | export interface SpineCache extends Phaser.Cache {
12 | addSpine: (key: string, data: any) => void;
13 | getSpine: (key: string) => any;
14 | spine: {[key: string]: SpineCacheData};
15 | }
16 |
17 | export interface SpineLoader extends Phaser.Loader {
18 | spine: (key: string, url: string, scalingVariants?: string[]) => void;
19 | cache: SpineCache;
20 | }
21 |
22 | export interface SpineGame extends Phaser.Game {
23 | add: SpineObjectFactory;
24 | load: SpineLoader;
25 | cache: SpineCache;
26 | }
27 |
28 | export interface SpineCacheData {
29 | atlas: string;
30 | basePath: string;
31 | variants: string[];
32 | }
33 |
34 | export class SpinePlugin extends Phaser.Plugin {
35 |
36 | public static RESOLUTION_REGEXP: RegExp = /@(.+)x/;
37 |
38 | constructor(game: SpineGame, parent: Phaser.PluginManager) {
39 | super(game, parent);
40 |
41 | this.addSpineCache();
42 | this.addSpineFactory();
43 | this.addSpineLoader();
44 | }
45 |
46 | private addSpineLoader() {
47 | (Phaser.Loader.prototype).spine = function(key: string, url: string, scalingVariants?: string[]) {
48 |
49 | let atlasKey: string = key+"Atlas";
50 |
51 | let cacheData: SpineCacheData = {
52 | atlas: atlasKey,
53 | basePath: (url.substring(0, url.lastIndexOf('/')) === '') ? '.' : url.substring(0, url.lastIndexOf('/')),
54 | variants: undefined
55 | };
56 |
57 | if (undefined === scalingVariants) {
58 | scalingVariants = [''];
59 | } else {
60 | cacheData.variants = scalingVariants;
61 | }
62 |
63 | scalingVariants.forEach((variant: string) => {
64 | //Check if an atlas file was loaded
65 | (this).onFileComplete.add((progress: any, cacheKey: string) => {
66 | if (cacheKey === atlasKey) {
67 | let atlas = new spine.Atlas(this.game.cache.getText(cacheKey), {
68 | load: (page: any, file: string, atlas: spine.Atlas) => {
69 | // console.log(page, file, atlas);
70 | (this).image(file, cacheData.basePath + '/' + file.substr(0, file.lastIndexOf('.')) + variant + '.png');
71 | }
72 | });
73 | }
74 | });
75 |
76 | //Load the atlas file
77 | (this).text(atlasKey, url.substr(0, url.lastIndexOf('.')) + variant + '.atlas');
78 | });
79 |
80 |
81 | (this).json(key, url);
82 |
83 | this.game.cache.addSpine(key, cacheData);
84 | };
85 | }
86 |
87 | /**
88 | * Extends the GameObjectFactory prototype with the support of adding spine. this allows us to add spine methods to the game just like any other object:
89 | * game.add.spine();
90 | */
91 | private addSpineFactory() {
92 | (Phaser.GameObjectFactory.prototype).spine = function(x: number, y: number, key: string, scalingVariant?: string, group?: Phaser.Group): PhaserSpine.Spine
93 | {
94 | if (group === undefined) { group = this.world; }
95 |
96 | var spineObject = new PhaserSpine.Spine(this.game, key, scalingVariant);
97 |
98 | spineObject.setToSetupPose();
99 | spineObject.position.x = x;
100 | spineObject.position.y = y;
101 |
102 | return group.add(spineObject);
103 | };
104 |
105 | (Phaser.GameObjectCreator.prototype).spine = function(x: number, y: number, key: string, scalingVariant?: string, group?: Phaser.Group): PhaserSpine.Spine
106 | {
107 | return new PhaserSpine.Spine(this.game, key, scalingVariant);
108 | };
109 | }
110 |
111 | /**
112 | * Extends the Phaser.Cache prototype with spine properties
113 | */
114 | private addSpineCache(): void {
115 | //Create the cache space
116 | (Phaser.Cache.prototype).spine = {};
117 |
118 | //Method for adding a spine dict to the cache space
119 | (Phaser.Cache.prototype).addSpine = function(key: string, data: SpineCacheData)
120 | {
121 | this.spine[key] = data;
122 | };
123 |
124 | //Method for fetching a spine dict from the cache space
125 | (Phaser.Cache.prototype).getSpine = function(key: string): SpineCacheData
126 | {
127 | if (!this.spine.hasOwnProperty(key)) {
128 | console.warn('Phaser.Cache.getSpine: Key "' + key + '" not found in Cache.')
129 | }
130 |
131 | return this.spine[key];
132 | };
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Phaser Spine
2 | ============
3 |
4 | Spine plugin for Phaser, it works, somehow.. No? Submit an issue, otherwise have fun :)
5 |
6 | Key features:
7 |
8 | * Spine for Phaser! :o
9 | * Skin support
10 | * Possible to combine skins
11 | * Mixes and fading animations
12 | * Support for scaled atlases
13 |
14 | Spine Version
15 | -------------
16 | Please note that the current spine version is an older version, and as a result of that it will work best with **Spine version 3.2**.
17 | There is a newer version of spine available (Spine-ts, up-to-date with latest spine runtime) but work on that is currently halted for this library.
18 |
19 | If you feel like helping out, you're welcome to clone the [spine-ts](https://github.com/azerion/phaser-spine/tree/spine-ts) branch of this library.
20 |
21 | Getting Started
22 | ---------------
23 | First you want to get a fresh copy of the plugin. You can get it from this repo or from npm, ain't that handy.
24 | ```
25 | npm install @azerion/phaser-spine --save-dev
26 | ```
27 |
28 | Next up you'd want to add it to your list of js sources you load into your game
29 | ```html
30 |
31 | ```
32 |
33 | After adding the script to the page you can activate it by enabling the plugin:
34 | ```javascript
35 | game.add.plugin(PhaserSpine.SpinePlugin);
36 | ```
37 |
38 |
39 | Usage
40 | -----
41 | Like any other asset in Phaser, you need to preload the spine object you want in your game. A spine Javascript export will deliver you three files; *.atlas, *.json and *.png.
42 | The preloader expects these to be in the same folder, and when so you can just preload the json file by adding the following code to your game:
43 |
44 | ```javascript
45 | game.load.spine(
46 | 'buddy', //The key used for Phaser's cache
47 | 'assets/buddy_skeleton.json' //The location of the spine's json file
48 | );
49 | ```
50 |
51 | Now you can just add the spine animation to your game:
52 | ```javascript
53 | buddy = game.add.spine(
54 | 400, //X positon
55 | 300, //Y position
56 | 'buddy' //the key of the object in cache
57 | );
58 | ```
59 |
60 | ### Playing animations
61 | Phaser-spine uses the same API as the original runtime for playing an animation, after adding the spine object to your game, you can call the following function on your object:
62 | ```javascript
63 | buddy.setAnimationByName(
64 | 0, //Track index
65 | "idle", //Animation's name
66 | true //If the animation should loop or not
67 | );
68 | ```
69 |
70 | ### Handling events
71 | You can handle Spine events, just add your callback to Spine.onEvent, it's regular [Phaser.Signal](https://phaser.io/docs/2.6.2/Phaser.Signal.html) object. Your callback should be defined with two arguments: event index (number) and event object (Spine.Event):
72 |
73 | ```javascript
74 | spineboy.onEvent.add(function (i,e) {
75 | console.log('name=' + e.data.name + ' int=' + e.intValue + ' float=' + e.floatValue + ' string=' + e.stringValue);
76 | }
77 | ```
78 |
79 |
80 | ### Crossfading animations
81 | Stacking animations in spine is rather simple, you just add non-looping animations on top of eachother:
82 | ```javascript
83 | spineboy.setAnimationByName(0, "jump", false); //We'd like to show this animation once
84 | spineboy.addAnimationByName(0, "walk", true); //And after the previous animations is finished, we continue with this one
85 | ```
86 |
87 | Now this will just simply chain the animation, and it will look a bit akward. Spine solves this by adding mixes that tell spine how to transition nicely from one animation to another.
88 | You can set mixes in phaser spine as well by doing the following:
89 | ```javascript
90 | spineboy.setMixByName("walk", "jump", 0.2); //transition from walk to jump and fade/blend it over a period of 0.2 seconds
91 | spineboy.setMixByName("jump", "walk", 0.4); //transition from jump to walk and fade/blend it over a period of 0.4 seconds
92 | ```
93 |
94 | ### Switching skins
95 | Another great additions to spine is the support of skins and the ability to freely switch between them. Like animations this is simple and we use the same API as the runtime.
96 | Don't forget to call setToSetupPose after switching skins to update all attachments correctly.
97 | ```javascript
98 | buddy.setSkinByName('outfit01');
99 | buddy.setToSetupPose();
100 | ```
101 |
102 | ### Combining skins
103 | Now the last final awesome part is that you can also create skins in code yourself by simply grouping other existing skins.
104 | ```javascript
105 | var newSkin = buddy.createCombinedSkin(
106 | 'outfit02', //The name of the new skin, will be automaticly added to the skeleton data
107 | 'vest', //One of the skins we want to combine
108 | 'mask' //The other skin we want to combine
109 | );
110 |
111 | //Setting the new skin can be set with:
112 | buddy.setSkin(newSkin);
113 | //Or by referencing the new name
114 | buddy.setSkinByName(outfit02);
115 |
116 | //And then we shouldn't forget to setToSetupPose ;)
117 | buddy.setToSetupPose();
118 | ```
119 |
120 | ### Scaled atlases
121 | In Spine it's possible to define different scales for your export atlases, including a special suffix that will be suffixed to each atlas name. By default this plugin assumes that no scale is configured, ergo everything is set with scale=1.
122 | If you export your atlases to a smaller scale, than this will only happen to the images, the original bone structure will still be defined at the original size you defined in your spine project.
123 |
124 | If the exported image is scaled up (or down), than this has to be inverted by the runtime in order to have the correct size of the images for the attachments. In order to do do this correctly, the suffix for a scale any other than 1 has to be set.
125 | By default this plugin parses the suffix with a regular expression that looks for numbers start with @ and ending by x. So an atlas file with a scale of 0.5 should have a suffix of @0.5x and the resultion file name would be spineBoy@0.5x.atlas.
126 |
127 | If you'd like a different setup you can do so by supplying a new RegExp object to the follow property:
128 | ```javascript
129 | PhaserSpine.SpinePlugin.RESOLUTION_REGEXP = /#(.+)r/;
130 | ```
131 | Now the Spine plugin will look for suffixes that look like: #0.5r
132 |
133 | The next step is to tell the preloader which scaling variants are available for loading, by adding them as an array in the 3rd optional parameter:
134 | ```javascript
135 | game.load.spine('shooter', "shooter.json", ['@0.7x', '@0.5x']);
136 | ```
137 | The preloader will load 1 json (with all the skeleton/animation data), and 2 images and 2 atlas files.
138 |
139 | Later in your game, when you create a new spine object, you again need to add the scaling variant you would like to have for your game. This way you can conditionally load different assets.
140 | If you pass no scaling variant to the object, it will just get the first variant from the array supplied when you preload the spine object.
141 | ```javascript
142 | shooter = game.add.spine(400, 300, "shooter", '@0.7x');
143 | //the above is equal to:
144 | shooter = game.add.spine(400, 300, "shooter");
145 | //because @0.7x is the first element of the array supplied to the preloader
146 | ```
147 |
148 |
149 | Todo
150 | ----
151 | - adding a body for physics
152 | - Handling input
153 |
154 | Credits
155 | -------
156 | Credit due, where credit's due as my mom always said. This version of phaser-spine is based on the original work by [Studio krok's PhaserSpine](https://github.com/StudioKrok/PhaserSpine)
157 |
158 | Disclaimer
159 | ----------
160 | We at Azerion just love playing and creating
161 | awesome games. We aren't affiliated with Phaser.io and/or esotericsoftware. We just needed some awesome spine animations in our awesome HTML5 games. Feel free to use it for enhancing your own awesome games!
162 |
163 | Phaser Spine is distributed under the MIT license. All 3rd party libraries and components are distributed under their
164 | respective license terms.
165 |
--------------------------------------------------------------------------------
/example/assets/goblins.json:
--------------------------------------------------------------------------------
1 | {
2 | "bones": [
3 | { "name": "root" },
4 | { "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
5 | { "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
6 | { "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 },
7 | { "name": "right upper leg", "parent": "hip", "length": 42.45, "x": -20.07, "y": -6.83, "rotation": -97.49 },
8 | { "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 93.92 },
9 | { "name": "left lower leg", "parent": "left upper leg", "length": 49.89, "x": 56.34, "y": 0.98, "rotation": -16.65 },
10 | { "name": "left shoulder", "parent": "torso", "length": 35.43, "x": 74.04, "y": -20.38, "rotation": -156.96 },
11 | { "name": "neck", "parent": "torso", "length": 18.38, "x": 81.67, "y": -6.34, "rotation": -1.51 },
12 | { "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 42.99, "y": -0.61, "rotation": -14.34 },
13 | { "name": "right shoulder", "parent": "torso", "length": 37.24, "x": 76.02, "y": 18.14, "rotation": 133.88 },
14 | { "name": "head", "parent": "neck", "length": 68.28, "x": 20.93, "y": 11.59, "rotation": -13.92 },
15 | { "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 37.85, "y": -2.34, "rotation": 28.16 },
16 | { "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 58.94, "y": -7.61, "rotation": 102.43 },
17 | { "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 37.6, "y": 0.31, "rotation": 36.32 },
18 | { "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
19 | { "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
20 | { "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 }
21 | ],
22 | "slots": [
23 | { "name": "left shoulder", "bone": "left shoulder", "attachment": "left shoulder" },
24 | { "name": "left arm", "bone": "left arm", "attachment": "left arm" },
25 | { "name": "left hand item", "bone": "left hand", "attachment": "spear" },
26 | { "name": "left hand", "bone": "left hand", "attachment": "left hand" },
27 | { "name": "left foot", "bone": "left foot", "attachment": "left foot" },
28 | { "name": "left lower leg", "bone": "left lower leg", "attachment": "left lower leg" },
29 | { "name": "left upper leg", "bone": "left upper leg", "attachment": "left upper leg" },
30 | { "name": "neck", "bone": "neck", "attachment": "neck" },
31 | { "name": "torso", "bone": "torso", "attachment": "torso" },
32 | { "name": "pelvis", "bone": "pelvis", "attachment": "pelvis" },
33 | { "name": "right foot", "bone": "right foot", "attachment": "right foot" },
34 | { "name": "right lower leg", "bone": "right lower leg", "attachment": "right lower leg" },
35 | { "name": "undie straps", "bone": "pelvis", "attachment": "undie straps" },
36 | { "name": "undies", "bone": "pelvis", "attachment": "undies" },
37 | { "name": "right upper leg", "bone": "right upper leg", "attachment": "right upper leg" },
38 | { "name": "head", "bone": "head", "attachment": "head" },
39 | { "name": "eyes", "bone": "head" },
40 | { "name": "right shoulder", "bone": "right shoulder", "attachment": "right shoulder" },
41 | { "name": "right arm", "bone": "right arm", "attachment": "right arm" },
42 | { "name": "right hand item", "bone": "right hand" },
43 | { "name": "right hand", "bone": "right hand", "attachment": "right hand" },
44 | { "name": "right hand item top", "bone": "right hand", "attachment": "shield" }
45 | ],
46 | "skins": {
47 | "default": {
48 | "left hand item": {
49 | "dagger": { "x": 7.88, "y": -23.45, "rotation": 10.47, "width": 26, "height": 108 },
50 | "spear": { "x": -4.55, "y": 39.2, "rotation": 13.04, "width": 22, "height": 368 }
51 | },
52 | "right hand item": {
53 | "dagger": { "x": 6.51, "y": -24.15, "rotation": -8.06, "width": 26, "height": 108 }
54 | },
55 | "right hand item top": {
56 | "shield": { "rotation": 93.49, "width": 70, "height": 72 }
57 | }
58 | },
59 | "goblin": {
60 | "eyes": {
61 | "eyes closed": { "name": "goblin/eyes-closed", "x": 32.21, "y": -21.27, "rotation": -88.92, "width": 34, "height": 12 }
62 | },
63 | "head": {
64 | "head": { "name": "goblin/head", "x": 25.73, "y": 2.33, "rotation": -92.29, "width": 103, "height": 66 }
65 | },
66 | "left arm": {
67 | "left arm": {
68 | "name": "goblin/left-arm",
69 | "x": 16.7,
70 | "y": -1.69,
71 | "scaleX": 1.057,
72 | "scaleY": 1.057,
73 | "rotation": 33.84,
74 | "width": 37,
75 | "height": 35
76 | }
77 | },
78 | "left foot": {
79 | "left foot": { "name": "goblin/left-foot", "x": 24.85, "y": 8.74, "rotation": 3.32, "width": 65, "height": 31 }
80 | },
81 | "left hand": {
82 | "left hand": {
83 | "name": "goblin/left-hand",
84 | "x": 3.47,
85 | "y": 3.41,
86 | "scaleX": 0.892,
87 | "scaleY": 0.892,
88 | "rotation": 31.14,
89 | "width": 36,
90 | "height": 41
91 | }
92 | },
93 | "left lower leg": {
94 | "left lower leg": { "name": "goblin/left-lower-leg", "x": 23.58, "y": -2.06, "rotation": 105.75, "width": 33, "height": 70 }
95 | },
96 | "left shoulder": {
97 | "left shoulder": { "name": "goblin/left-shoulder", "x": 15.56, "y": -2.26, "rotation": 62.01, "width": 29, "height": 44 }
98 | },
99 | "left upper leg": {
100 | "left upper leg": { "name": "goblin/left-upper-leg", "x": 29.68, "y": -3.87, "rotation": 89.09, "width": 33, "height": 73 }
101 | },
102 | "neck": {
103 | "neck": { "name": "goblin/neck", "x": 10.1, "y": 0.42, "rotation": -93.69, "width": 36, "height": 41 }
104 | },
105 | "pelvis": {
106 | "pelvis": { "name": "goblin/pelvis", "x": -5.61, "y": 0.76, "width": 62, "height": 43 }
107 | },
108 | "right arm": {
109 | "right arm": { "name": "goblin/right-arm", "x": 16.44, "y": -1.04, "rotation": 94.32, "width": 23, "height": 50 }
110 | },
111 | "right foot": {
112 | "right foot": { "name": "goblin/right-foot", "x": 23.56, "y": 9.8, "rotation": 1.52, "width": 63, "height": 33 }
113 | },
114 | "right hand": {
115 | "right hand": { "name": "goblin/right-hand", "x": 7.88, "y": 2.78, "rotation": 91.96, "width": 36, "height": 37 }
116 | },
117 | "right lower leg": {
118 | "right lower leg": { "name": "goblin/right-lower-leg", "x": 25.68, "y": -3.15, "rotation": 111.83, "width": 36, "height": 76 }
119 | },
120 | "right shoulder": {
121 | "right shoulder": { "name": "goblin/right-shoulder", "x": 15.68, "y": -1.03, "rotation": 130.65, "width": 39, "height": 45 }
122 | },
123 | "right upper leg": {
124 | "right upper leg": { "name": "goblin/right-upper-leg", "x": 20.35, "y": 1.47, "rotation": 97.49, "width": 34, "height": 63 }
125 | },
126 | "torso": {
127 | "torso": { "name": "goblin/torso", "x": 38.09, "y": -3.87, "rotation": -94.95, "width": 68, "height": 96 }
128 | },
129 | "undie straps": {
130 | "undie straps": { "name": "goblin/undie-straps", "x": -3.87, "y": 13.1, "scaleX": 1.089, "width": 55, "height": 19 }
131 | },
132 | "undies": {
133 | "undies": { "name": "goblin/undies", "x": 6.3, "y": 0.12, "rotation": 0.91, "width": 36, "height": 29 }
134 | }
135 | },
136 | "goblingirl": {
137 | "eyes": {
138 | "eyes closed": { "name": "goblingirl/eyes-closed", "x": 28, "y": -25.54, "rotation": -87.04, "width": 37, "height": 21 }
139 | },
140 | "head": {
141 | "head": { "name": "goblingirl/head", "x": 27.71, "y": -4.32, "rotation": -85.58, "width": 103, "height": 81 }
142 | },
143 | "left arm": {
144 | "left arm": { "name": "goblingirl/left-arm", "x": 19.64, "y": -2.42, "rotation": 33.05, "width": 37, "height": 35 }
145 | },
146 | "left foot": {
147 | "left foot": { "name": "goblingirl/left-foot", "x": 25.17, "y": 7.92, "rotation": 3.32, "width": 65, "height": 31 }
148 | },
149 | "left hand": {
150 | "left hand": {
151 | "name": "goblingirl/left-hand",
152 | "x": 4.34,
153 | "y": 2.39,
154 | "scaleX": 0.896,
155 | "scaleY": 0.896,
156 | "rotation": 30.34,
157 | "width": 35,
158 | "height": 40
159 | }
160 | },
161 | "left lower leg": {
162 | "left lower leg": { "name": "goblingirl/left-lower-leg", "x": 25.02, "y": -0.6, "rotation": 105.75, "width": 33, "height": 70 }
163 | },
164 | "left shoulder": {
165 | "left shoulder": { "name": "goblingirl/left-shoulder", "x": 19.8, "y": -0.42, "rotation": 61.21, "width": 28, "height": 46 }
166 | },
167 | "left upper leg": {
168 | "left upper leg": { "name": "goblingirl/left-upper-leg", "x": 30.21, "y": -2.95, "rotation": 89.09, "width": 33, "height": 70 }
169 | },
170 | "neck": {
171 | "neck": { "name": "goblingirl/neck", "x": 6.16, "y": -3.14, "rotation": -98.86, "width": 35, "height": 41 }
172 | },
173 | "pelvis": {
174 | "pelvis": { "name": "goblingirl/pelvis", "x": -3.87, "y": 3.18, "width": 62, "height": 43 }
175 | },
176 | "right arm": {
177 | "right arm": { "name": "goblingirl/right-arm", "x": 16.85, "y": -0.66, "rotation": 93.52, "width": 28, "height": 50 }
178 | },
179 | "right foot": {
180 | "right foot": { "name": "goblingirl/right-foot", "x": 23.46, "y": 9.66, "rotation": 1.52, "width": 63, "height": 33 }
181 | },
182 | "right hand": {
183 | "right hand": { "name": "goblingirl/right-hand", "x": 7.21, "y": 3.43, "rotation": 91.16, "width": 36, "height": 37 }
184 | },
185 | "right lower leg": {
186 | "right lower leg": { "name": "goblingirl/right-lower-leg", "x": 26.15, "y": -3.27, "rotation": 111.83, "width": 36, "height": 76 }
187 | },
188 | "right shoulder": {
189 | "right shoulder": { "name": "goblingirl/right-shoulder", "x": 14.46, "y": 0.45, "rotation": 129.85, "width": 39, "height": 45 }
190 | },
191 | "right upper leg": {
192 | "right upper leg": { "name": "goblingirl/right-upper-leg", "x": 19.69, "y": 2.13, "rotation": 97.49, "width": 34, "height": 63 }
193 | },
194 | "torso": {
195 | "torso": { "name": "goblingirl/torso", "x": 36.28, "y": -5.14, "rotation": -95.74, "width": 68, "height": 96 }
196 | },
197 | "undie straps": {
198 | "undie straps": { "name": "goblingirl/undie-straps", "x": -1.51, "y": 14.18, "width": 55, "height": 19 }
199 | },
200 | "undies": {
201 | "undies": { "name": "goblingirl/undies", "x": 5.4, "y": 1.7, "width": 36, "height": 29 }
202 | }
203 | }
204 | },
205 | "animations": {
206 | "walk": {
207 | "slots": {
208 | "eyes": {
209 | "attachment": [
210 | { "time": 0.7, "name": "eyes closed" },
211 | { "time": 0.8, "name": null }
212 | ]
213 | }
214 | },
215 | "bones": {
216 | "left upper leg": {
217 | "rotate": [
218 | { "time": 0, "angle": -26.55 },
219 | { "time": 0.1333, "angle": -8.78 },
220 | { "time": 0.2333, "angle": 9.51 },
221 | { "time": 0.3666, "angle": 30.74 },
222 | { "time": 0.5, "angle": 25.33 },
223 | { "time": 0.6333, "angle": 26.11 },
224 | { "time": 0.7333, "angle": -7.7 },
225 | { "time": 0.8666, "angle": -21.19 },
226 | { "time": 1, "angle": -26.55 }
227 | ],
228 | "translate": [
229 | { "time": 0, "x": -1.32, "y": 1.7 },
230 | { "time": 0.3666, "x": -0.06, "y": 2.42 },
231 | { "time": 1, "x": -1.32, "y": 1.7 }
232 | ]
233 | },
234 | "right upper leg": {
235 | "rotate": [
236 | { "time": 0, "angle": 42.45 },
237 | { "time": 0.1333, "angle": 52.1 },
238 | { "time": 0.2333, "angle": 8.53 },
239 | { "time": 0.5, "angle": -16.93 },
240 | { "time": 0.6333, "angle": 1.89 },
241 | {
242 | "time": 0.7333,
243 | "angle": 28.06,
244 | "curve": [ 0.462, 0.11, 1, 1 ]
245 | },
246 | {
247 | "time": 0.8666,
248 | "angle": 58.68,
249 | "curve": [ 0.5, 0.02, 1, 1 ]
250 | },
251 | { "time": 1, "angle": 42.45 }
252 | ],
253 | "translate": [
254 | { "time": 0, "x": 6.23, "y": 0 },
255 | { "time": 0.2333, "x": 2.14, "y": 2.4 },
256 | { "time": 0.5, "x": 2.44, "y": 4.8 },
257 | { "time": 1, "x": 6.23, "y": 0 }
258 | ]
259 | },
260 | "left lower leg": {
261 | "rotate": [
262 | { "time": 0, "angle": -22.98 },
263 | { "time": 0.1333, "angle": -63.5 },
264 | { "time": 0.2333, "angle": -73.76 },
265 | { "time": 0.5, "angle": 5.11 },
266 | { "time": 0.6333, "angle": -28.29 },
267 | { "time": 0.7333, "angle": 4.08 },
268 | { "time": 0.8666, "angle": 3.53 },
269 | { "time": 1, "angle": -22.98 }
270 | ],
271 | "translate": [
272 | { "time": 0, "x": 0, "y": 0 },
273 | { "time": 0.2333, "x": 2.55, "y": -0.47 },
274 | { "time": 0.5, "x": 0, "y": 0, "curve": "stepped" },
275 | { "time": 1, "x": 0, "y": 0 }
276 | ]
277 | },
278 | "left foot": {
279 | "rotate": [
280 | { "time": 0, "angle": -3.69 },
281 | { "time": 0.1333, "angle": -10.42 },
282 | { "time": 0.2333, "angle": -5.01 },
283 | { "time": 0.3666, "angle": 3.87 },
284 | { "time": 0.5, "angle": -3.87 },
285 | { "time": 0.6333, "angle": 2.78 },
286 | { "time": 0.7333, "angle": 1.68 },
287 | { "time": 0.8666, "angle": -8.54 },
288 | { "time": 1, "angle": -3.69 }
289 | ]
290 | },
291 | "right shoulder": {
292 | "rotate": [
293 | {
294 | "time": 0,
295 | "angle": 5.29,
296 | "curve": [ 0.264, 0, 0.75, 1 ]
297 | },
298 | { "time": 0.6333, "angle": 6.65 },
299 | { "time": 1, "angle": 5.29 }
300 | ]
301 | },
302 | "right arm": {
303 | "rotate": [
304 | {
305 | "time": 0,
306 | "angle": -4.02,
307 | "curve": [ 0.267, 0, 0.804, 0.99 ]
308 | },
309 | {
310 | "time": 0.6333,
311 | "angle": 19.78,
312 | "curve": [ 0.307, 0, 0.787, 0.99 ]
313 | },
314 | { "time": 1, "angle": -4.02 }
315 | ]
316 | },
317 | "right hand": {
318 | "rotate": [
319 | { "time": 0, "angle": 8.98 },
320 | { "time": 0.6333, "angle": 0.51 },
321 | { "time": 1, "angle": 8.98 }
322 | ]
323 | },
324 | "left shoulder": {
325 | "rotate": [
326 | {
327 | "time": 0,
328 | "angle": 6.25,
329 | "curve": [ 0.339, 0, 0.683, 1 ]
330 | },
331 | {
332 | "time": 0.5,
333 | "angle": -11.78,
334 | "curve": [ 0.281, 0, 0.686, 0.99 ]
335 | },
336 | { "time": 1, "angle": 6.25 }
337 | ],
338 | "translate": [
339 | { "time": 0, "x": 1.15, "y": 0.23 }
340 | ]
341 | },
342 | "left hand": {
343 | "rotate": [
344 | {
345 | "time": 0,
346 | "angle": -21.23,
347 | "curve": [ 0.295, 0, 0.755, 0.98 ]
348 | },
349 | {
350 | "time": 0.5,
351 | "angle": -27.28,
352 | "curve": [ 0.241, 0, 0.75, 0.97 ]
353 | },
354 | { "time": 1, "angle": -21.23 }
355 | ]
356 | },
357 | "left arm": {
358 | "rotate": [
359 | {
360 | "time": 0,
361 | "angle": 28.37,
362 | "curve": [ 0.339, 0, 0.683, 1 ]
363 | },
364 | {
365 | "time": 0.5,
366 | "angle": 60.09,
367 | "curve": [ 0.281, 0, 0.686, 0.99 ]
368 | },
369 | { "time": 1, "angle": 28.37 }
370 | ]
371 | },
372 | "torso": {
373 | "rotate": [
374 | { "time": 0, "angle": -10.28 },
375 | {
376 | "time": 0.1333,
377 | "angle": -15.38,
378 | "curve": [ 0.545, 0, 0.818, 1 ]
379 | },
380 | {
381 | "time": 0.3666,
382 | "angle": -9.78,
383 | "curve": [ 0.58, 0.17, 0.669, 0.99 ]
384 | },
385 | {
386 | "time": 0.6333,
387 | "angle": -15.75,
388 | "curve": [ 0.235, 0.01, 0.795, 1 ]
389 | },
390 | {
391 | "time": 0.8666,
392 | "angle": -7.06,
393 | "curve": [ 0.209, 0, 0.816, 0.98 ]
394 | },
395 | { "time": 1, "angle": -10.28 }
396 | ],
397 | "translate": [
398 | { "time": 0, "x": -1.29, "y": 1.68 }
399 | ]
400 | },
401 | "right foot": {
402 | "rotate": [
403 | { "time": 0, "angle": -5.25 },
404 | { "time": 0.2333, "angle": -1.91 },
405 | { "time": 0.3666, "angle": -6.45 },
406 | { "time": 0.5, "angle": -5.39 },
407 | { "time": 0.7333, "angle": -11.68 },
408 | { "time": 0.8666, "angle": 0.46 },
409 | { "time": 1, "angle": -5.25 }
410 | ]
411 | },
412 | "right lower leg": {
413 | "rotate": [
414 | {
415 | "time": 0,
416 | "angle": -3.39,
417 | "curve": [ 0.316, 0.01, 0.741, 0.98 ]
418 | },
419 | {
420 | "time": 0.1333,
421 | "angle": -45.53,
422 | "curve": [ 0.229, 0, 0.738, 0.97 ]
423 | },
424 | { "time": 0.2333, "angle": -4.83 },
425 | { "time": 0.5, "angle": -19.53 },
426 | { "time": 0.6333, "angle": -64.8 },
427 | {
428 | "time": 0.7333,
429 | "angle": -82.56,
430 | "curve": [ 0.557, 0.18, 1, 1 ]
431 | },
432 | { "time": 1, "angle": -3.39 }
433 | ],
434 | "translate": [
435 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
436 | { "time": 0.5, "x": 0, "y": 0 },
437 | { "time": 0.6333, "x": 2.18, "y": 0.21 },
438 | { "time": 1, "x": 0, "y": 0 }
439 | ]
440 | },
441 | "hip": {
442 | "rotate": [
443 | { "time": 0, "angle": 0, "curve": "stepped" },
444 | { "time": 1, "angle": 0 }
445 | ],
446 | "translate": [
447 | { "time": 0, "x": 0, "y": -4.16 },
448 | {
449 | "time": 0.1333,
450 | "x": 0,
451 | "y": -7.05,
452 | "curve": [ 0.359, 0.47, 0.646, 0.74 ]
453 | },
454 | { "time": 0.3666, "x": 0, "y": 6.78 },
455 | { "time": 0.5, "x": 0, "y": -6.13 },
456 | {
457 | "time": 0.6333,
458 | "x": 0,
459 | "y": -7.05,
460 | "curve": [ 0.359, 0.47, 0.646, 0.74 ]
461 | },
462 | { "time": 0.8666, "x": 0, "y": 6.78 },
463 | { "time": 1, "x": 0, "y": -4.16 }
464 | ]
465 | },
466 | "neck": {
467 | "rotate": [
468 | { "time": 0, "angle": 3.6 },
469 | { "time": 0.1333, "angle": 17.49 },
470 | { "time": 0.2333, "angle": 6.1 },
471 | { "time": 0.3666, "angle": 3.45 },
472 | { "time": 0.5, "angle": 5.17 },
473 | { "time": 0.6333, "angle": 18.36 },
474 | { "time": 0.7333, "angle": 6.09 },
475 | { "time": 0.8666, "angle": 2.28 },
476 | { "time": 1, "angle": 3.6 }
477 | ]
478 | },
479 | "head": {
480 | "rotate": [
481 | {
482 | "time": 0,
483 | "angle": 3.6,
484 | "curve": [ 0, 0, 0.704, 1.17 ]
485 | },
486 | { "time": 0.1333, "angle": -0.2 },
487 | { "time": 0.2333, "angle": 6.1 },
488 | { "time": 0.3666, "angle": 3.45 },
489 | {
490 | "time": 0.5,
491 | "angle": 5.17,
492 | "curve": [ 0, 0, 0.704, 1.61 ]
493 | },
494 | { "time": 0.6666, "angle": 1.1 },
495 | { "time": 0.7333, "angle": 6.09 },
496 | { "time": 0.8666, "angle": 2.28 },
497 | { "time": 1, "angle": 3.6 }
498 | ]
499 | }
500 | }
501 | }
502 | }
503 | }
--------------------------------------------------------------------------------
/ts/Spine.ts:
--------------------------------------------------------------------------------
1 | declare module "phaser-spine" {
2 | export = PhaserSpine;
3 | }
4 |
5 | (Phaser.Rope).prototype.postUpdate = function () {};
6 |
7 | spine.Bone.yDown = true;
8 |
9 | module PhaserSpine {
10 | import SpineCacheData = PhaserSpine.SpineCacheData;
11 | import Skin = spine.Skin;
12 | export class Spine extends Phaser.Group
13 | {
14 | static globalAutoUpdate: boolean = true;
15 |
16 | private skeleton: spine.Skeleton;
17 | private skeletonData: spine.SkeletonData;
18 | private stateData: spine.AnimationStateData;
19 | private state: spine.AnimationState;
20 | private slotContainers: Phaser.Group[];
21 | private lastTime: number;
22 | private imageScale: number = 1;
23 | private globalTint: number;
24 |
25 | public game: PhaserSpine.SpineGame;
26 | public onEvent: Phaser.Signal;
27 | public onComplete: Phaser.Signal;
28 | public onEnd: Phaser.Signal;
29 |
30 | /**
31 | * @class Spine
32 | * @extends Phaser.Group
33 | * @constructor
34 | * @param game {Phaser.Game} the game reference to add this object
35 | * @param key {String} the key to find the assets for this object
36 | */
37 | constructor(game: PhaserSpine.SpineGame, key: string, scalingVariant?: string)
38 | {
39 | super(game);
40 |
41 | let data: SpineCacheData = this.game.cache.getSpine(key);
42 |
43 | if (undefined !== scalingVariant && data.variants.indexOf(scalingVariant) !== -1) {
44 | this.imageScale = this.getScaleFromVariant(scalingVariant);
45 | } else if (data.variants && data.variants.length >= 1) {
46 | this.imageScale = this.getScaleFromVariant(data.variants[0]);
47 | }
48 |
49 | let textureLoader = new PhaserSpine.SpineTextureLoader(game);
50 | // create a spine atlas using the loaded text and a spine texture loader instance //
51 | let spineAtlas = new spine.Atlas(game.cache.getText(data.atlas), textureLoader);
52 | // now we use an atlas attachment loader //
53 | let attachmentLoader = new spine.AtlasAttachmentLoader(spineAtlas);
54 | // spine animation
55 | let spineJsonParser = new spine.SkeletonJson(attachmentLoader);
56 |
57 | //get the Skeleton Data
58 | this.skeletonData = spineJsonParser.readSkeletonData(game.cache.getJSON(key));
59 |
60 | if (!this.skeletonData) {
61 | throw new Error('Spine data must be preloaded using Loader.spine');
62 | }
63 |
64 | this.onEvent = new Phaser.Signal();
65 | this.onComplete = new Phaser.Signal();
66 | this.onEnd = new Phaser.Signal();
67 |
68 | this.skeleton = new spine.Skeleton(this.skeletonData);
69 | this.skeleton.updateWorldTransform();
70 |
71 | this.stateData = new spine.AnimationStateData(this.skeletonData);
72 | this.state = new spine.AnimationState(this.stateData);
73 | this.state.onEvent = this.onEvent.dispatch.bind(this.onEvent);
74 | this.state.onComplete = this.onComplete.dispatch.bind(this.onComplete);
75 | this.state.onEnd = this.onEnd.dispatch.bind(this.onEnd);
76 |
77 | this.slotContainers = [];
78 |
79 | for (let i: number = 0, n = this.skeleton.slots.length; i < n; i++) {
80 | let slot: spine.Slot = this.skeleton.slots[i];
81 | let attachment: spine.Attachment = slot.attachment;
82 |
83 | let slotContainer = new Phaser.Group(game);
84 | this.slotContainers.push(slotContainer);
85 | this.add(slotContainer);
86 |
87 | if (attachment instanceof spine.RegionAttachment) {
88 | let spriteName: string = attachment.rendererObject.name;
89 | let sprite: Phaser.Sprite = this.createSprite(slot, attachment);
90 | slot.currentSprite = sprite;
91 | slot.currentSpriteName = spriteName;
92 | slotContainer.add(sprite);
93 | } else if (attachment instanceof spine.WeightedMeshAttachment) {
94 | let mesh: Phaser.Rope = this.createMesh(slot, attachment);
95 | slot.currentMesh = mesh;
96 | slot.currentMeshName = attachment.name;
97 | slotContainer.add(mesh);
98 | } else {
99 | continue;
100 | }
101 | }
102 |
103 | this.autoUpdate = true;
104 | }
105 |
106 | get autoUpdate(): boolean {
107 | return (this.updateTransform === PhaserSpine.Spine.prototype.autoUpdateTransform);
108 | };
109 |
110 | set autoUpdate(value: boolean) {
111 | this.updateTransform = value ? PhaserSpine.Spine.prototype.autoUpdateTransform : PIXI.DisplayObjectContainer.prototype.updateTransform;
112 | };
113 |
114 | private getScaleFromVariant(variant: string): number {
115 | let scale: RegExpExecArray = SpinePlugin.RESOLUTION_REGEXP.exec(variant);
116 | if (scale) {
117 | return parseFloat(scale[1]);
118 | }
119 | return 1;
120 | }
121 |
122 | public setTint (tint: number): void {
123 |
124 | this.globalTint = tint;
125 |
126 | let slots = this.skeleton.slots;
127 | for(let i = 0; i < slots.length; i++) {
128 |
129 | let slot = slots[i];
130 | if(slot.currentSprite) slot.currentSprite.tint = tint;
131 |
132 | }
133 | }
134 |
135 | /**
136 | * Update the spine skeleton and its animations by delta time (dt)
137 | *
138 | * @method update
139 | * @param dt {Number} Delta time. Time by which the animation should be updated
140 | */
141 | public update(dt?: number): void {
142 | if (dt === undefined) {
143 | return;
144 | }
145 |
146 | this.state.update(dt);
147 | this.state.apply(this.skeleton);
148 | this.skeleton.updateWorldTransform();
149 |
150 | let drawOrder: spine.Slot[] = this.skeleton.drawOrder;
151 | let slots: spine.Slot[] = this.skeleton.slots;
152 | for (var i = 0, n = drawOrder.length; i < n; i++) {
153 | if (drawOrder[i].currentSprite !== undefined) {
154 | this.children[i] = drawOrder[i].currentSprite.parent
155 | }
156 | }
157 |
158 | for (var i = 0, n = slots.length; i < n; i++) {
159 | var slot: any = slots[i];
160 | var attachment: any = slot.attachment;
161 | var slotContainer: any = this.slotContainers[i];
162 |
163 | if (!attachment) {
164 | slotContainer.visible = false;
165 | continue;
166 | }
167 |
168 | var type = attachment.type;
169 |
170 | if (type === spine.AttachmentType.region) {
171 | if (attachment.rendererObject) {
172 | if (!slot.currentSpriteName || slot.currentSpriteName !== attachment.name) {
173 | var spriteName = attachment.rendererObject.name;
174 | if (slot.currentSprite !== undefined) {
175 | slot.currentSprite.visible = false;
176 | }
177 | slot.sprites = slot.sprites || {};
178 | if (slot.sprites[spriteName] !== undefined) {
179 | slot.sprites[spriteName].visible = true;
180 | } else {
181 | var sprite = this.createSprite(slot, attachment);
182 | slotContainer.add(sprite);
183 | }
184 |
185 | slot.currentSprite = slot.sprites[spriteName];
186 | slot.currentSpriteName = spriteName;
187 | }
188 | }
189 |
190 | var bone: spine.Bone = slot.bone;
191 |
192 | //Update positions
193 | slotContainer.position.x = attachment.x * bone.a + attachment.y * bone.b + bone.worldX;
194 | slotContainer.position.y = attachment.x * bone.c + attachment.y * bone.d + bone.worldY;
195 |
196 | //Update scaling
197 | slotContainer.scale.x = bone.getWorldScaleX();
198 | slotContainer.scale.y = bone.getWorldScaleY();
199 | //Update rotation
200 | slotContainer.rotation = (bone.getWorldRotationX() - attachment.rotation) * Math.PI / 180;
201 |
202 | if (bone.getWorldScaleY() < 0) {
203 | slotContainer.scale.y = -slotContainer.scale.y;
204 | }
205 | if (bone.getWorldScaleX() < 0) {
206 | slotContainer.scale.x = -slotContainer.scale.x;
207 |
208 | }
209 | if (bone.getWorldScaleY() < 0 || bone.getWorldScaleX() < 0) {
210 |
211 | slotContainer.rotation = -slotContainer.rotation;
212 | }
213 |
214 | slot.currentSprite.blendMode = slot.blendMode;
215 | if (!this.globalTint) {
216 | slot.currentSprite.tint = slot.currentSprite.tint = parseInt(Phaser.Color.componentToHex(255 * slot.r).substring(0, 2) + Phaser.Color.componentToHex(255 * slot.g).substring(0, 2) + Phaser.Color.componentToHex(255 * slot.b).substring(0, 2), 16);
217 | }
218 |
219 | } else if (type === spine.AttachmentType.weightedmesh || type === spine.AttachmentType.weightedlinkedmesh) {
220 | if (!slot.currentMeshName || slot.currentMeshName !== attachment.name) {
221 | var meshName = attachment.name;
222 | if (slot.currentMesh !== undefined) {
223 | slot.currentMesh.visible = false;
224 | }
225 |
226 | slot.meshes = slot.meshes || {};
227 |
228 | if (slot.meshes[meshName] !== undefined) {
229 | slot.meshes[meshName].visible = true;
230 | } else {
231 | var mesh = this.createMesh(slot, attachment);
232 | slotContainer.add(mesh);
233 | }
234 |
235 | slot.currentMesh = slot.meshes[meshName];
236 | slot.currentMeshName = meshName;
237 | }
238 |
239 | (attachment).computeWorldVertices(slot.bone.skeleton.x, slot.bone.skeleton.y, slot, slot.currentMesh.vertices);
240 |
241 | } else {
242 | slotContainer.visible = false;
243 | continue;
244 | }
245 | slotContainer.visible = true;
246 |
247 | slotContainer.alpha = slot.a;
248 | }
249 | }
250 |
251 | /**
252 | * Children should always be destroyed
253 | *
254 | * @param destroyChildren
255 | * @param soft
256 | */
257 | public destroy(destroyChildren?: boolean, soft?: boolean): void {
258 | super.destroy(true, soft)
259 | }
260 |
261 | /**
262 | * When autoupdate is set to yes this function is used as pixi's updateTransform function
263 | *
264 | * @method autoUpdateTransform
265 | * @private
266 | */
267 | public autoUpdateTransform() {
268 | if (Spine.globalAutoUpdate) {
269 | this.lastTime = this.lastTime || Date.now();
270 | var timeDelta = (Date.now() - this.lastTime) * 0.001;
271 | this.lastTime = Date.now();
272 |
273 | this.update(timeDelta);
274 | } else {
275 | this.lastTime = 0;
276 | }
277 |
278 | PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
279 | };
280 |
281 | /**
282 | * Create a new sprite to be used with spine.RegionAttachment
283 | *
284 | * @method createSprite
285 | * @param slot {spine.Slot} The slot to which the attachment is parented
286 | * @param attachment {spine.RegionAttachment} The attachment that the sprite will represent
287 | * @private
288 | */
289 | public createSprite(slot: any, attachment: any): Phaser.Sprite {
290 |
291 | let descriptor: any = attachment.rendererObject;
292 | let baseTexture: any = descriptor.page.rendererObject;
293 | let spriteRect: PIXI.Rectangle = new PIXI.Rectangle(descriptor.x,
294 | descriptor.y,
295 | descriptor.rotate ? descriptor.height : descriptor.width,
296 | descriptor.rotate ? descriptor.width : descriptor.height);
297 |
298 | let spriteTexture: PIXI.Texture = new PIXI.Texture(baseTexture, spriteRect);
299 | let sprite: Phaser.Sprite = new Phaser.Sprite(this.game, 0, 0, spriteTexture);
300 |
301 | let baseRotation: number = descriptor.rotate ? Math.PI * 0.5 : 0.0;
302 | sprite.scale.x = descriptor.width / descriptor.originalWidth * attachment.scaleX / this.imageScale;
303 | sprite.scale.y = descriptor.height / descriptor.originalHeight * attachment.scaleY / this.imageScale;
304 |
305 | sprite.rotation = baseRotation;
306 |
307 | sprite.anchor.x = (0.5 * descriptor.originalWidth - descriptor.offsetX) / descriptor.width;
308 | sprite.anchor.y = 1.0 - ((0.5 * descriptor.originalHeight - descriptor.offsetY) / descriptor.height);
309 |
310 | sprite.alpha = attachment.a;
311 |
312 | if (descriptor.rotate) {
313 | let x1: number = sprite.scale.x;
314 | sprite.scale.x = sprite.scale.y;
315 | sprite.scale.y = x1;
316 | }
317 |
318 | slot.sprites = slot.sprites || {};
319 | slot.sprites[descriptor.name] = sprite;
320 |
321 | return sprite;
322 | };
323 |
324 | public createMesh(slot: any, attachment: any): Phaser.Rope {
325 | let descriptor: any = attachment.rendererObject;
326 | let baseTexture: any = descriptor.page.rendererObject;
327 | let texture: PIXI.Texture = new PIXI.Texture(baseTexture);
328 |
329 |
330 | let strip: Phaser.Rope = new Phaser.Rope(this.game, 0, 0, texture);
331 | (strip).drawMode = 1;
332 | strip.canvasPadding = 1.5;
333 |
334 | (strip).vertices = new spine.Float32Array(attachment.uvs.length);
335 | strip.uvs = attachment.uvs;
336 | strip.indices = attachment.triangles;
337 | strip.alpha = attachment.a;
338 |
339 | slot.meshes = slot.meshes || {};
340 | slot.meshes[attachment.name] = strip;
341 |
342 | return strip;
343 | };
344 |
345 | /**
346 | * [setMixByName wrap to stateData.setMixByName]
347 | * @param {String} fromName [source animation name]
348 | * @param {String} toName [target animation name]
349 | * @param {Float} duration [Duration in the transition of the animations]
350 | */
351 | public setMixByName(fromName: string, toName: string, duration: number): void {
352 | this.stateData.setMixByName(fromName, toName, duration);
353 | };
354 |
355 | /**
356 | * exposing the state's setAnimation
357 | * We override the original runtime's error because warnings dont stop the VM
358 | *
359 | * @param {number} trackIndex
360 | * @param {string} animationName
361 | * @param {boolean} loop
362 | * @param {number} delay
363 | * @returns {any}
364 | */
365 | public setAnimationByName(trackIndex: number, animationName: string, loop: boolean = false): spine.TrackEntry {
366 | let animation: spine.Animation = this.state.data.skeletonData.findAnimation(animationName);
367 | if (!animation) {
368 | console.warn("Animation not found: " + animationName);
369 | return null;
370 | }
371 |
372 | return this.state.setAnimation(trackIndex, animation, loop);
373 | };
374 |
375 | /**
376 | * exposing the state's addAnimation
377 | * We override the original runtime's error because warnings dont stop the VM
378 | *
379 | * @param {number} trackIndex
380 | * @param {string} animationName
381 | * @param {boolean} loop
382 | * @param {number} delay
383 | * @returns {any}
384 | */
385 | public addAnimationByName(trackIndex: number, animationName: string, loop: boolean = false, delay: number = 0): spine.TrackEntry {
386 | let animation: spine.Animation = this.state.data.skeletonData.findAnimation(animationName);
387 | if (!animation) {
388 | console.warn("Animation not found: " + animationName);
389 | return null;
390 | }
391 | return this.state.addAnimation(trackIndex, animation, loop, delay);
392 | };
393 |
394 | /**
395 | * get the name of the animation currently playing
396 | *
397 | * @param {number} trackIndex
398 | * @returns {string}
399 | */
400 | public getCurrentAnimationForTrack(trackIndex: number): string {
401 | if (!this.state.tracks[trackIndex] || !this.state.tracks[trackIndex].animation) {
402 | console.warn("No animation found on track index: ", trackIndex);
403 | return "";
404 | }
405 | return this.state.tracks[trackIndex].animation.name;
406 | }
407 |
408 | /**
409 | * Exposing the skeleton's method to change the skin by skinName
410 | * We override the original runtime's error because warnings dont stop the VM
411 | *
412 | * @param {string} skinName The name of the skin we'd like to set
413 | */
414 | public setSkinByName(skinName: string): void {
415 | let skin: spine.Skin = this.skeleton.data.findSkin(skinName);
416 | if (!skin) {
417 | console.warn("Skin not found: " + skinName);
418 | return;
419 | }
420 | this.skeleton.setSkin(skin);
421 | }
422 |
423 | /**
424 | * Exposing the skeleton's method to change the skin
425 | *
426 | * @param skin
427 | */
428 | public setSkin(skin: spine.Skin): void {
429 | this.skeleton.setSkin(skin);
430 | }
431 |
432 | /**
433 | * Set to initial setup pose
434 | */
435 | public setToSetupPose(): void {
436 | this.skeleton.setToSetupPose();
437 | }
438 |
439 | /**
440 | * You can combine skins here by supplying a name for the new skin, and then a nummer of existing skins names that needed to be combined in the new skin
441 | * If the skins that will be combined contain any double attachment, only the first attachment will be added to the newskin.
442 | * any subsequent attachment that is double will not be added!
443 | *
444 | * @param newSkinName
445 | * @param skinNames
446 | */
447 | public createCombinedSkin(newSkinName: string, ...skinNames: string[]): spine.Skin {
448 | if (skinNames.length === 0) {
449 | console.warn('Unable to combine skins when no skins are passed...');
450 | return;
451 | }
452 |
453 | let newSkin: spine.Skin = new spine.Skin(newSkinName);
454 |
455 | for (let i: number = 0; i < skinNames.length; i++) {
456 | let skinName: string = skinNames[i];
457 | let skin = this.skeleton.data.findSkin(skinName);
458 | if (!skin) {
459 | console.warn("Skin not found: " + skinName);
460 | return;
461 | }
462 |
463 | for (let key in skin.attachments) {
464 | let slotKeyPair = key.split(':');
465 | let slotIndex = slotKeyPair[0];
466 | let attachmentName = slotKeyPair[1];
467 | let attachment = skin.attachments[key];
468 |
469 | if (undefined === slotIndex || undefined === attachmentName) {
470 | console.warn('something went wrong with reading the attachments index and/or name');
471 | return;
472 | }
473 |
474 | if (newSkin.getAttachment(slotIndex, attachmentName) !== undefined) {
475 | console.warn('Found double attachment for: ' + skinName + '. Skipping');
476 | continue;
477 | }
478 |
479 | newSkin.addAttachment(slotIndex, attachmentName, attachment);
480 | }
481 | }
482 |
483 | this.skeleton.data.skins.push(newSkin);
484 |
485 | return newSkin;
486 | }
487 | }
488 | }
489 |
--------------------------------------------------------------------------------
/vendor/Spine.d.ts:
--------------------------------------------------------------------------------
1 | declare module spine {
2 | var degRad: number;
3 | var radDeg: number;
4 |
5 | class Float32Array {
6 | constructor(...args: any[]);
7 | }
8 | class Uint32Array {
9 | constructor(...args: any[]);
10 | }
11 | class Uint16Array {
12 | constructor(...args: any[]);
13 | }
14 |
15 | var temp: Float32Array;
16 |
17 | enum BlendMode {
18 | normal,
19 | additive,
20 | multiply,
21 | screen
22 | }
23 |
24 | class BoneData {
25 | public name: string;
26 | public parent: Bone;
27 |
28 | public length: number;
29 | public x: number;
30 | public y: number;
31 | public rotation: number;
32 | public scaleX: number;
33 | public scaleY: number;
34 | public inheritScale: boolean;
35 | public inheritRotation: boolean;
36 |
37 | constructor(name: string, parent: Bone);
38 | }
39 |
40 | class SlotData {
41 | public name: string;
42 | public boneData: BoneData;
43 |
44 | public r: number;
45 | public g: number;
46 | public b: number;
47 | public a: number;
48 | public attachmentName: string;
49 | public blendMode: BlendMode;
50 |
51 | constructor(name: string, boneData: BoneData);
52 | }
53 |
54 | class IkConstraintData {
55 | public name: string;
56 | public bones: Bone[];
57 |
58 | public target: Bone;
59 | public bendDirection: number;
60 | public mix: number;
61 |
62 | constructor(name: string);
63 | }
64 |
65 | class TransformConstraintData {
66 | public name: string;
67 |
68 | public bone: Bone;
69 | public target: Bone;
70 | public translateMix: number;
71 | public x: number;
72 | public y: number;
73 |
74 | constructor(name: string);
75 | }
76 |
77 | class Bone {
78 | public data: BoneData;
79 | public skeleton: Skeleton;
80 | public parent: Bone;
81 |
82 | static yDown: boolean;
83 |
84 | public x: number;
85 | public y: number;
86 | public rotation: number;
87 | public scaleX: number;
88 | public scaleY: number;
89 | public a: number;
90 | public b: number;
91 | public worldX: number;
92 | public c: number;
93 | public d: number;
94 | public worldY: number;
95 | public worldSignX: number;
96 | public worldSignY: number;
97 |
98 | constructor(boneData: BoneData, skeleton: Skeleton, parent: Bone);
99 |
100 | public update(): void;
101 | public updateWorldTransformWith(): void;
102 | public updateWorldTransform(x: number, y: number, rotation: number, scaleX: number, scaleY: number): void;
103 | public setToSetupPose(): void;
104 | public getWorldRotationX(): number;
105 | public getWorldRotationY(): number;
106 | public getWorldScaleX(): number;
107 | public getWorldScaleY(): number;
108 | public worldToLocal(world: any): any;
109 | public localToWorld(local: any): any;
110 | }
111 |
112 | class Slot {
113 | public data: SlotData;
114 | public bone: Bone;
115 | public attachmentVertices: Float32Array;
116 | public currentSpriteName: string;
117 | public currentSprite: Phaser.Sprite;
118 | public currentMeshName: string;
119 | public currentMesh: PIXI.Strip;
120 | public sprites: {[spriteName: string]: Phaser.Sprite};
121 |
122 | public r: number;
123 | public g: number;
124 | public b: number;
125 | public a: number;
126 | private _attachmentTime: number;
127 | public attachment: Attachment;
128 |
129 | constructor(slotData: SlotData, bone: Bone);
130 |
131 | public setAttachment(attachment: Attachment): void;
132 | public setAttachmentTime(time: number): void;
133 | public getAttachmentTime(): Attachment;
134 | public setToSetupPose(): void;
135 | }
136 |
137 | class IkConstraint {
138 | public data: any;
139 | public mix: any;
140 | public bendDirection: number;
141 | public bones: Bone[];
142 | public target: Bone;
143 |
144 | constructor(data: any, skeleton: Skeleton);
145 |
146 | public update(): void;
147 | public apply(): void;
148 |
149 | public static apply1(bone: Bone, targetX: number, targetY: number, alpha: number): void;
150 | public static apply2(parent: any, child: any, targetX: number, targetY: number, bendDir: number, alpha: number): void;
151 | }
152 |
153 | class TransformConstraint {
154 | public data: any;
155 |
156 | public translateMix: any;
157 | public x: number;
158 | public y: number;
159 | public bone: Bone;
160 | public target: Bone;
161 |
162 | constructor(data: any, skeleton: Skeleton);
163 |
164 | public apply(): void;
165 | public update(): void;
166 | }
167 |
168 | class Skin {
169 | public name: string;
170 | public attachments: any;
171 |
172 | constructor(name: string);
173 |
174 | public addAttachment(slotIndex: string, name: string, attachment: Attachment): void;
175 | public getAttachment(slotIndex: string, name: string): any;
176 | private _attachAll(skeleton: Skeleton, oldSkin: Skin);
177 | }
178 |
179 | class Animation {
180 | public name: string;
181 | public timelines: TimeLine;
182 | public duration: number;
183 |
184 | constructor(name: string, timelines: TimeLine, duration: number);
185 | public apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: any): void;
186 | public mix(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: any, alpha: number): void;
187 |
188 | public static binarySearch(values: number[], target: number, step: number): any;
189 | public static binarySearch1(values: number[], target: number): any;
190 | public static linearSearch(values: number[], target: number, step: number): number;
191 | }
192 |
193 | class Curves {
194 | public curves: Float32Array;
195 |
196 | constructor(frameCount: number);
197 |
198 | public setLinear(frameIndex: number): void;
199 | public setStepped(frameIndex: number): void;
200 | /** Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
201 | * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
202 | * the difference between the keyframe's values. */
203 | public setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
204 | public getCurvePercent(frameIndex: number, percent: number): number;
205 | }
206 |
207 | class SkeletonData {
208 | public bones: BoneData[];
209 | public slots: SlotData[];
210 | public skins: Skin[];
211 | public events: EventData[];
212 | public animations: Animation[];
213 | public ikConstraints: IkConstraintData[];
214 | public transformConstraints: TransformConstraintData[];
215 |
216 | public name: string;
217 | public defaultSkin: Skin;
218 | public width: number;
219 | public height: number;
220 | public version: number;
221 | public hash: string;
222 |
223 | constructor();
224 |
225 | /** @return May be null. */
226 | public findBone(boneName: string): spine.BoneData;
227 | /** @return -1 if the bone was not found. */
228 | public findBoneIndex(boneName: string): number;
229 | /** @return May be null. */
230 | public findSlot(slotName: string): spine.SlotData;
231 | /** @return -1 if the bone was not found. */
232 | public findSlotIndex(slotName: string): number;
233 | /** @return May be null. */
234 | public findSkin(skinName: string): spine.Skin;
235 | /** @return May be null. */
236 | public findEvent(eventName: string): spine.EventData;
237 | /** @return May be null. */
238 | public findAnimation(animationName: string): Animation;
239 | public findIkConstraint(constraintName: string): IkConstraint;
240 | public findTransformConstraints(constraintName: string): TransformConstraintData;
241 | }
242 |
243 | class Skeleton {
244 | public bones: Bone[];
245 | public slots: Slot[];
246 | public drawOrder: any[];
247 | public ikConstraints: IkConstraint[];
248 | public transformConstraints: TransformConstraint[];
249 | public data: SkeletonData;
250 | public cache: any[];
251 |
252 | public x: number;
253 | public y: number;
254 | public skin: Skin;
255 | public r: number;
256 | public g: number;
257 | public b: number;
258 | public a: number;
259 | public time: number;
260 | public flipX: boolean;
261 | public flipY: boolean;
262 |
263 | constructor(skeletonData: SkeletonData);
264 |
265 | public updateCache(): void;
266 | /** Updates the world transform for each bone. */
267 | public updateWorldTransform(): void;
268 | /** Sets the bones and slots to their setup pose values. */
269 | public setToSetupPose(): void;
270 | public setBonesToSetupPose(): void;
271 | public setSlotsToSetupPose(): void;
272 | /** @return May return null. */
273 | public getRootBone(): spine.Bone;
274 | /** @return May be null. */
275 | public findBone(boneName: any): spine.Bone;
276 | /** @return -1 if the bone was not found. */
277 | public findBoneIndex(boneName: any): number;
278 | /** @return May be null. */
279 | public findSlot(slotName: any): spine.Slot;
280 | /** @return -1 if the bone was not found. */
281 | public findSlotIndex(slotName: any): number;
282 | public setSkinByName(skinName: any): void;
283 | /** Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments
284 | * from the new skin are attached if the corresponding attachment from the old skin was attached.
285 | * @param newSkin May be null. */
286 | public setSkin(newSkin: any): void;
287 | /** @return May be null. */
288 | public getAttachmentBySlotName(slotName: any, attachmentName: any): any;
289 | /** @return May be null. */
290 | public getAttachmentBySlotIndex(slotIndex: any, attachmentName: any): any;
291 | public setAttachment(slotName: any, attachmentName: any): void;
292 | public findIkConstraint(constraintName: string): IkConstraint;
293 | public findTransformConstraint(constraintName: string): TransformConstraint;
294 | public update(delta: number): void;
295 | }
296 |
297 | class EventData {
298 | public name: string;
299 |
300 | constructor(name: string);
301 |
302 | public intValue: number;
303 | public floatValue: number;
304 | public stringValue: string;
305 | }
306 |
307 | class Event {
308 | public data: any;
309 | public time: number;
310 |
311 | constructor(time: number, data: any);
312 |
313 | public intValue: number;
314 | public floatValue: number;
315 | public stringValue: string;
316 | }
317 |
318 | enum AttachmentType {
319 | region,
320 | boundingbox,
321 | mesh,
322 | weightedmesh,
323 | linkedmesh,
324 | weightedlinkedmesh
325 | }
326 |
327 | interface Attachment {
328 | name: string;
329 | type: AttachmentType
330 | }
331 |
332 | class RegionAttachment implements Attachment {
333 | public name: string;
334 | public offset: Float32Array;
335 | public uvs: Float32Array;
336 |
337 | public type: AttachmentType;
338 | public x: number;
339 | public y: number;
340 | public rotation: number;
341 | public scaleX: number;
342 | public scaleY: number;
343 | public width: number;
344 | public height: number;
345 | public r: number;
346 | public g: number;
347 | public b: number;
348 | public a: number;
349 | public path: any;
350 | public rendererObject: any;
351 | public regionOffsetX: number;
352 | public regionOffsetY: number;
353 | public regionWidth: number;
354 | public regionHeight: number;
355 | public regionOriginalWidth: number;
356 | public regionOriginalHeight: number;
357 |
358 | constructor(name: string);
359 |
360 | public setUVs(u: any, v: any, u2: any, v2: any, rotate: any): void;
361 | public updateOffset(): void;
362 | public computeVertices(x: any, y: any, bone: any, vertices: any): void;
363 | }
364 |
365 |
366 | class MeshAttachment implements Attachment {
367 | public name: string;
368 | public type: AttachmentType;
369 | public vertices: any[];
370 | public uvs: any[];
371 | public regionUVs: any[];
372 | public triangles: any[];
373 | public hullLength: number;
374 | public r: number;
375 | public g: number;
376 | public b: number;
377 | public a: number;
378 | public path: any;
379 | public inheritFFD: boolean;
380 | public parentMesh: any;
381 | public rendererObject: any;
382 | public regionU: number;
383 | public regionV: number;
384 | public regionU2: number;
385 | public regionV2: number;
386 | public regionRotate: boolean;
387 | public regionOffsetX: number;
388 | public regionOffsetY: number;
389 | public regionWidth: number;
390 | public regionHeight: number;
391 | public regionOriginalWidth: number;
392 | public regionOriginalHeight: number;
393 | public edges: any;
394 | public width: number;
395 | public height: number;
396 |
397 | constructor(name: string);
398 |
399 | public updateUVs(): void;
400 | public setParentMesh(parentMesh: any): void;
401 | public computeWorldVertices(x: any, y: any, slot: any, worldVertices: any): void;
402 | }
403 |
404 | class WeightedMeshAttachment implements Attachment {
405 | public name: string;
406 | public type: AttachmentType;
407 | public bones: any[];
408 | public uvs: any[];
409 | public regionUVs: any[];
410 | public triangles: any[];
411 | public hullLength: number;
412 | public r: number;
413 | public g: number;
414 | public b: number;
415 | public a: number;
416 | public path: any;
417 | public inheritFFD: boolean;
418 | public parentMesh: any;
419 | public rendererObject: any;
420 | public regionU: number;
421 | public regionV: number;
422 | public regionU2: number;
423 | public regionV2: number;
424 | public regionRotate: boolean;
425 | public regionOffsetX: number;
426 | public regionOffsetY: number;
427 | public regionWidth: number;
428 | public regionHeight: number;
429 | public regionOriginalWidth: number;
430 | public regionOriginalHeight: number;
431 | public edges: any;
432 | public width: number;
433 | public height: number;
434 |
435 | constructor(name: string);
436 |
437 | public updateUVs(u: any, v: any, u2: any, v2: any, rotate: any): void;
438 | public setParentMesh(parentMesh: any): void;
439 | public computeWorldVertices(x: any, y: any, slot: any, worldVertices: any): void;
440 | }
441 |
442 | class BoundingBoxAttachment implements Attachment {
443 | public name: string;
444 | public type: AttachmentType;
445 | public vertices: any[];
446 |
447 | constructor(name: string);
448 |
449 | public computeWorldVertices(x: any, y: any, bone: any, worldVertices: any): void;
450 | }
451 |
452 | interface TimeLine {
453 | frames: Float32Array;
454 |
455 | getFrameCount(): number;
456 | setFrame(...args: any[]): void;
457 | apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
458 | }
459 |
460 | class RotateTimeline implements TimeLine {
461 | public boneIndex: number;
462 | public curves: Curves;
463 | public frames: Float32Array;
464 |
465 | constructor(frameCount: number);
466 |
467 | public getFrameCount(): number;
468 | public setFrame(frameIndex: number, time: number, angle: number): void;
469 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
470 | }
471 |
472 | class TranslateTimeline implements TimeLine {
473 | public boneIndex: number;
474 | public curves: Curves;
475 | public frames: Float32Array;
476 |
477 | constructor(frameCount: number);
478 |
479 | public getFrameCount(): number;
480 | public setFrame(frameIndex: any, time: any, x: any, y: any): void;
481 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
482 | }
483 |
484 | class ScaleTimeline implements TimeLine {
485 | public boneIndex: number;
486 | public curves: Curves;
487 | public frames: Float32Array;
488 |
489 | constructor(frameCount: number);
490 |
491 | public getFrameCount(): number;
492 | public setFrame(frameIndex: any, time: any, x: any, y: any): void;
493 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
494 | }
495 |
496 | class ColorTimeline implements TimeLine {
497 | public slotIndex: number;
498 | public curves: Curves;
499 | public frames: Float32Array;
500 |
501 | constructor(frameCount: number);
502 |
503 | public getFrameCount(): number;
504 | public setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
505 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
506 | }
507 |
508 | class AttachmentTimeline implements TimeLine {
509 | public slotIndex: number;
510 | public curves: Curves;
511 | public frames: Float32Array;
512 | public attachmentNames: string[];
513 |
514 | constructor(frameCount: number);
515 |
516 | public getFrameCount(): number;
517 | public setFrame(frameIndex: number, time: number, attachmentName: string): void;
518 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: number): void;
519 | }
520 |
521 | class EventTimeline implements TimeLine {
522 | public frames: Float32Array;
523 | public events: any[];
524 |
525 | constructor(frameCount: number);
526 |
527 | public getFrameCount(): number;
528 | public setFrame(frameIndex: any, event: any): void;
529 | /** Fires events for frames > lastTime and <= time. */
530 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: any): void;
531 | }
532 |
533 | class DrawOrderTimeline implements TimeLine {
534 | public frames: Float32Array;
535 | public drawOrders: any[];
536 |
537 | constructor(frameCount: number);
538 |
539 | public getFrameCount(): number;
540 | public setFrame(frameIndex: any, time: any, drawOrder: any): void;
541 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: any): void;
542 | }
543 |
544 | class FfdTimeline implements TimeLine {
545 | public curves: Curves;
546 | public frames: Float32Array;
547 | public frameVertices: any[];
548 |
549 | slotIndex: number;
550 | attachment: number;
551 |
552 | constructor(frameCount: number);
553 |
554 | public getFrameCount(): number;
555 | public setFrame(frameIndex: any, time: any, vertices: any): void;
556 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: any): void;
557 | }
558 |
559 | class IkConstraintTimeline implements TimeLine {
560 | public frames: Float32Array;
561 | public curves: Curves;
562 |
563 | constructor(frameCount: number);
564 |
565 | public getFrameCount(): number;
566 | public setFrame(frameIndex: any, time: any, mix: any, bendDirection: number): void;
567 | public apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: any, alpha: any): void;
568 | }
569 |
570 | class AnimationStateData {
571 | public skeletonData: SkeletonData;
572 | public animationToMixTime: any;
573 | public defaultMix: number;
574 |
575 | constructor(skeletonData: SkeletonData);
576 |
577 | public setMixByName(fromName: any, toName: any, duration: any): void;
578 | public setMix(from: any, to: any, duration: any): void;
579 | public getMix(from: any, to: any): any;
580 | }
581 |
582 | class TrackEntry {
583 | public next: any;
584 | public previous: any;
585 | public animation: any;
586 | public loop: boolean;
587 | public delay: number;
588 | public time: number;
589 | public lastTime: number;
590 | public endTime: number;
591 | public timeScale: number;
592 | public mixTime: number;
593 | public mixDuration: number;
594 | public onStart: any;
595 | public onEnd: any;
596 | public onComplete: any;
597 | public onEvent: any;
598 | }
599 |
600 | class AnimationState {
601 | public data: spine.AnimationStateData;
602 | public tracks: any[];
603 | public events: spine.Event[];
604 | public onStart: any;
605 | public onEnd: any;
606 | public onComplete: any;
607 | public onEvent: any;
608 | public timeScale: number;
609 | constructor(data: spine.AnimationStateData);
610 | public update(delta: any): void;
611 | public apply(skeleton: spine.Skeleton): void;
612 | public clearTracks(): void;
613 | public clearTrack(trackIndex: any): void;
614 | private _expandToIndex(index);
615 | public setCurrent(index: any, entry: any): void;
616 | public setAnimationByName(trackIndex: any, animationName: any, loop: any): void;
617 | /** Set the current animation. Any queued animations are cleared. */
618 | public setAnimation(trackIndex: any, animation: any, loop: any): spine.TrackEntry;
619 | public addAnimationByName(trackIndex: any, animationName: any, loop: any, delay: any): void;
620 | /** Adds an animation to be played delay seconds after the current or last queued animation.
621 | * @param delay May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. */
622 | public addAnimation(trackIndex: any, animation: any, loop: any, delay: any): spine.TrackEntry;
623 | /** May be null. */
624 | public getCurrent(trackIndex: any): any;
625 | }
626 |
627 | class SkeletonJson {
628 | public attachmentLoader: any;
629 | public scale: number;
630 | constructor(attachmentLoader: any);
631 | public readCurve(timeline: any, frameIndex: any, valueMap: any): void;
632 | public toColor(hexString: any, colorIndex: any): number;
633 | public readSkeletonData(root: any): SkeletonData;
634 | public readAttachment(skin: any, name: any, map: any): any;
635 | public readAnimation(name: any, map: any, skeletonData: any): void;
636 | public getFloatArray(map: any, name: any, scale: number): Float32Array;
637 | public getUint32Array(map: any, name: any): Uint32Array;
638 | public getUint16Array(map: any, name: any): Uint16Array;
639 | }
640 |
641 | class Atlas {
642 | public textureLoader: any;
643 | public pages: any[];
644 | public regions: any[];
645 |
646 | static Format: {
647 | alpha: number;
648 | intensity: number;
649 | luminanceAlpha: number;
650 | rgb565: number;
651 | rgba4444: number;
652 | rgb888: number;
653 | rgba8888: number;
654 | };
655 |
656 | static TextureFilter: {
657 | nearest: number;
658 | linear: number;
659 | mipMap: number;
660 | mipMapNearestNearest: number;
661 | mipMapLinearNearest: number;
662 | mipMapNearestLinear: number;
663 | mipMapLinearLinear: number;
664 | };
665 |
666 | static TextureWrap: {
667 | mirroredRepeat: number;
668 | clampToEdge: number;
669 | repeat: number;
670 | };
671 | constructor(atlasText: any, textureLoader: any);
672 | public findRegion(name: any): any;
673 | public dispose(): void;
674 | public updateUVs(page: any): void;
675 | }
676 |
677 | class AtlasPage {
678 | public name: any;
679 | public format: any;
680 | public minFilter: any;
681 | public magFilter: any;
682 | public uWrap: any;
683 | public vWrap: any;
684 | public rendererObject: any;
685 | public width: any;
686 | public height: any;
687 | }
688 |
689 | class AtlasAttachmentLoader {
690 | public atlas: any;
691 | constructor(atlas: any);
692 | public newAttachment(skin: any, type: any, name: any): any;
693 | }
694 |
695 | class AtlasRegion {
696 | public page: any;
697 | public name: any;
698 | public x: number;
699 | public y: number;
700 | public width: number;
701 | public height: number;
702 | public u: number;
703 | public v: number;
704 | public u2: number;
705 | public v2: number;
706 | public offsetX: number;
707 | public offsetY: number;
708 | public originalWidth: number;
709 | public originalHeight: number;
710 | public index: number;
711 | public rotate: boolean;
712 | public splits: any;
713 | public pads: any;
714 | }
715 |
716 | class AtlasReader {
717 | private lines;
718 | private index;
719 | constructor(text: any);
720 | public trim(value: any): any;
721 | public readLine(): string;
722 | public readValue(): any;
723 | /** Returns the number of tuple values read (2 or 4). */
724 | public readTuple(tuple: any): number;
725 | }
726 |
727 | class SkeletonBounds {
728 | public polygonPool: any[];
729 | public polygons: any[];
730 | public boundingBoxes: any[];
731 | private minX;
732 | private minY;
733 | private maxX;
734 | private maxY;
735 | constructor();
736 | public update(skeleton: any, updateAabb: any): void;
737 | public aabbCompute(): void;
738 | /** Returns true if the axis aligned bounding box contains the point. */
739 | public aabbContainsPoint(x: any, y: any): boolean;
740 | /** Returns true if the axis aligned bounding box intersects the line segment. */
741 | public aabbIntersectsSegment(x1: any, y1: any, x2: any, y2: any): boolean;
742 | /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
743 | public aabbIntersectsSkeleton(bounds: any): boolean;
744 | /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
745 | * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
746 | public containsPoint(x: any, y: any): any;
747 | /** Returns true if the polygon contains the point. */
748 | public polygonContainsPoint(polygon: any, x: any, y: any): boolean;
749 | /** Returns true if the polygon contains the line segment. */
750 | public intersectsSegment(polygon: any, x1: any, y1: any, x2: any, y2: any): boolean;
751 | public getPolygon(attachment: any): any;
752 | public getWidth(): number;
753 | public getHeight(): number;
754 | }
755 | }
--------------------------------------------------------------------------------
/example/assets/buddy_skeleton.json:
--------------------------------------------------------------------------------
1 | {
2 | "skeleton": { "hash": "2w0LpLTE4nBFJEDC6870DQeAXmU", "spine": "3.0.12", "width": 800, "height": 600, "images": "./ASSETS/" },
3 | "bones": [
4 | { "name": "root" },
5 | { "name": "legs_rest", "parent": "root", "length": 135.23, "x": -1.89, "y": -202.15, "rotation": 88.01 },
6 | { "name": "body", "parent": "legs_rest", "length": 126.45, "x": 136.71, "y": 0.49, "rotation": -1.48 },
7 | { "name": "pelvis", "parent": "body", "length": 16.11, "x": 5.18, "y": -4.94, "rotation": -177.94 },
8 | { "name": "leg_right_top", "parent": "pelvis", "length": 64.85, "x": 7.35, "y": 4.89, "rotation": 28.63 },
9 | { "name": "leg_right_bottom", "parent": "leg_right_top", "length": 68.61, "x": 65.02, "y": -0.79, "rotation": -37.41 },
10 | { "name": "foot_right", "parent": "leg_right_bottom", "length": 35.8, "x": 68.62, "y": 0.27, "rotation": 97.61 },
11 | { "name": "leg_left_top", "parent": "pelvis", "length": 58.21, "x": 7.01, "y": -13.98, "rotation": 3.69 },
12 | { "name": "leg_left_bottom", "parent": "leg_left_top", "length": 77.88, "x": 58.21, "rotation": -30.57 },
13 | { "name": "foot_left", "parent": "leg_left_bottom", "length": 40.11, "x": 77.89, "y": 0.32, "rotation": 116.75 },
14 | { "name": "head", "parent": "body", "length": 85.49, "x": 126.45, "y": -0.01, "rotation": 5.74 },
15 | { "name": "hair", "parent": "head", "length": 50.19, "x": 86.1, "y": -5.98, "rotation": -27.55 },
16 | { "name": "facial_gear", "parent": "head", "x": 51.13, "y": -10.85 },
17 | { "name": "face", "parent": "head", "x": 30.8, "y": -11.89 },
18 | { "name": "eye_right", "parent": "head", "x": 50.03, "y": -20.32 },
19 | { "name": "eye_left", "parent": "head", "x": 53.5, "y": 2.5 },
20 | { "name": "brow_right", "parent": "head", "x": 64.72, "y": -25.16 },
21 | { "name": "brow_left", "parent": "head", "x": 70.64, "y": 5.65 },
22 | { "name": "body_gear", "parent": "body", "length": 81.95, "x": 101.84, "y": -1.72, "rotation": 179.32 },
23 | { "name": "arm_right_top", "parent": "body", "length": 60.75, "x": 94.99, "y": -19.8, "rotation": -164.95 },
24 | { "name": "arm_right_bottom", "parent": "arm_right_top", "length": 42.07, "x": 60.75, "y": 0.16, "rotation": 5.6 },
25 | { "name": "hand_right", "parent": "arm_right_bottom", "length": 32.4, "x": 42.07, "y": -0.06, "rotation": 6.33 },
26 | { "name": "arm_left_top", "parent": "body", "length": 72.38, "x": 93.85, "y": 34.2, "rotation": 173.99 },
27 | { "name": "arm_left_bottom", "parent": "arm_left_top", "length": 66.3, "x": 72.38, "rotation": 9.85 }
28 | ],
29 | "slots": [
30 | { "name": "bg", "bone": "root", "attachment": "bg" },
31 | { "name": "buddy_arm_right_bottom", "bone": "arm_right_bottom" },
32 | { "name": "buddy_arm_right_top", "bone": "arm_right_top" },
33 | { "name": "buddy_arm_walk_right_bottom", "bone": "arm_right_bottom", "attachment": "buddy_arm_walk_right_bottom" },
34 | { "name": "buddy_arm_walk_right_top", "bone": "arm_right_top", "attachment": "buddy_arm_walk_right_top" },
35 | { "name": "buddy_body", "bone": "body", "attachment": "buddy_body" },
36 | { "name": "buddy_foot_left", "bone": "foot_left", "attachment": "buddy_foot_left" },
37 | { "name": "buddy_foot_right", "bone": "foot_right", "attachment": "buddy_foot_right" },
38 | { "name": "buddy_hair", "bone": "hair", "attachment": "buddy_hair" },
39 | { "name": "buddy_hand_right", "bone": "hand_right" },
40 | { "name": "buddy_head", "bone": "head", "attachment": "buddy_head" },
41 | { "name": "buddy_leg_left_bottom", "bone": "leg_left_bottom", "attachment": "buddy_leg_left_bottom" },
42 | { "name": "buddy_leg_left_top", "bone": "leg_left_top", "attachment": "buddy_leg_left_top" },
43 | { "name": "buddy_leg_right_bottom", "bone": "leg_right_bottom", "attachment": "buddy_leg_right_bottom" },
44 | { "name": "buddy_leg_right_top", "bone": "leg_right_top", "attachment": "buddy_leg_right_top" },
45 | { "name": "buddy_legs_full", "bone": "legs_rest", "attachment": "buddy_legs_full" },
46 | { "name": "buddy_pelvis", "bone": "pelvis", "attachment": "buddy_pelvis" },
47 | { "name": "buddy_face", "bone": "face", "attachment": "buddy_face_happy" },
48 | { "name": "buddy_eye_left", "bone": "eye_left", "attachment": "buddy_eye" },
49 | { "name": "buddy_brow_left", "bone": "brow_left", "attachment": "buddy_brow_left" },
50 | { "name": "buddy_arm_left_rest", "bone": "arm_left_top" },
51 | { "name": "buddy_brow_right", "bone": "brow_right", "attachment": "buddy_brow_right" },
52 | { "name": "buddy_eye_right", "bone": "eye_right", "attachment": "buddy_eye" },
53 | { "name": "body_gear", "bone": "body_gear", "attachment": "body_gear" },
54 | { "name": "body_assets", "bone": "body", "attachment": "body_assets" },
55 | { "name": "buddy_arm_walk_left_top", "bone": "arm_left_top", "attachment": "buddy_arm_walk_left_top" },
56 | { "name": "buddy_arm_walk_left_bottom", "bone": "arm_left_bottom", "attachment": "buddy_arm_walk_left_bottom" },
57 | { "name": "facial_gear", "bone": "facial_gear", "attachment": "facial_gear" }
58 | ],
59 | "skins": {
60 | "default": {
61 | "bg": {
62 | "bg": { "width": 800, "height": 600 }
63 | },
64 | "buddy_arm_left_rest": {
65 | "buddy_arm_left_rest": { "x": 74.54, "y": -7.82, "rotation": 99.47, "width": 47, "height": 153 }
66 | },
67 | "buddy_arm_right_bottom": {
68 | "buddy_arm_right_bottom": { "x": 19.88, "y": -5.59, "rotation": -66.75, "width": 35, "height": 54 }
69 | },
70 | "buddy_arm_right_top": {
71 | "buddy_arm_right_top": { "x": 34.35, "y": -1.12, "rotation": 42.85, "width": 48, "height": 57 }
72 | },
73 | "buddy_arm_walk_left_bottom": {
74 | "buddy_arm_walk_left_bottom": { "x": 37.56, "y": -2.83, "rotation": 74.11, "width": 46, "height": 77 }
75 | },
76 | "buddy_arm_walk_left_top": {
77 | "buddy_arm_walk_left_top": { "x": 36.3, "y": -2.68, "rotation": 111.49, "width": 37, "height": 74 }
78 | },
79 | "buddy_arm_walk_right_bottom": {
80 | "buddy_arm_walk_right_bottom": { "x": 39.13, "y": -4.69, "rotation": 56.83, "width": 47, "height": 70 }
81 | },
82 | "buddy_arm_walk_right_top": {
83 | "buddy_arm_walk_right_top": { "x": 31.62, "y": -0.58, "rotation": 91.22, "width": 14, "height": 78 }
84 | },
85 | "buddy_body": {
86 | "buddy_body": { "x": 71.33, "y": 4.34, "rotation": -86.54, "width": 64, "height": 141 }
87 | },
88 | "buddy_brow_left": {
89 | "buddy_brow_left": { "x": 0.73, "y": 1.78, "rotation": -92.29, "width": 29, "height": 18 }
90 | },
91 | "buddy_brow_right": {
92 | "buddy_brow_right": { "x": 1.9, "y": 0.08, "rotation": -92.29, "width": 18, "height": 13 }
93 | },
94 | "buddy_eye_left": {
95 | "buddy_eye": { "x": 0.01, "y": -0.18, "rotation": -92.29, "width": 7, "height": 16 }
96 | },
97 | "buddy_eye_right": {
98 | "buddy_eye": { "x": 1.37, "y": -0.55, "rotation": -92.29, "width": 7, "height": 16 }
99 | },
100 | "buddy_face": {
101 | "buddy_face_happy": { "x": 11.23, "y": 6.68, "rotation": -92.29, "width": 36, "height": 59 },
102 | "buddy_face_normal": { "x": 12.86, "y": 4.2, "rotation": -92.29, "width": 31, "height": 56 }
103 | },
104 | "buddy_foot_left": {
105 | "buddy_foot_left": { "x": 19.01, "y": 6.45, "rotation": 1.47, "width": 67, "height": 28 }
106 | },
107 | "buddy_foot_right": {
108 | "buddy_foot_right": { "x": 12.33, "y": 7.37, "rotation": 2.51, "width": 62, "height": 28 }
109 | },
110 | "buddy_hair": {
111 | "buddy_hair": { "x": 20.83, "y": 12.56, "rotation": -64.58, "width": 90, "height": 68 }
112 | },
113 | "buddy_hand_right": {
114 | "buddy_hand_right": { "x": 15.42, "y": 1.21, "rotation": -73.17, "width": 60, "height": 46 }
115 | },
116 | "buddy_head": {
117 | "buddy_head": { "x": 45.09, "y": 5.57, "rotation": -92.29, "width": 75, "height": 98 }
118 | },
119 | "buddy_leg_left_bottom": {
120 | "buddy_leg_left_bottom": { "x": 42.69, "y": -1.41, "rotation": 118.46, "width": 58, "height": 80 }
121 | },
122 | "buddy_leg_left_top": {
123 | "buddy_leg_left_top": { "x": 27.86, "y": -0.09, "rotation": 87.67, "width": 17, "height": 61 }
124 | },
125 | "buddy_leg_right_bottom": {
126 | "buddy_leg_right_bottom": { "x": 37.78, "y": -5.47, "rotation": 100.14, "width": 35, "height": 76 }
127 | },
128 | "buddy_leg_right_top": {
129 | "buddy_leg_right_top": { "x": 30.16, "y": 1.6, "rotation": 62.51, "width": 40, "height": 65 }
130 | },
131 | "buddy_legs_full": {
132 | "buddy_legs_full": { "x": 75.34, "y": -9.39, "rotation": -88.01, "width": 130, "height": 150 }
133 | },
134 | "buddy_pelvis": {
135 | "buddy_pelvis": { "x": 3.99, "y": -6.62, "rotation": 91.37, "width": 33, "height": 21 }
136 | }
137 | },
138 | "outfit01": {
139 | "body_assets": {
140 | "body_assets": { "name": "buddy_outfit01_collar", "x": 101.93, "y": 0.06, "rotation": -86.54, "width": 35, "height": 31 }
141 | },
142 | "body_gear": {
143 | "body_gear": { "name": "buddy_outfit01_tie", "x": 44.14, "y": -4.78, "rotation": 94.12, "width": 31, "height": 90 }
144 | },
145 | "facial_gear": {
146 | "facial_gear": { "name": "buddy_outfit01_glasses", "x": 1.07, "y": 7.47, "rotation": -92.29, "width": 78, "height": 28 }
147 | }
148 | },
149 | "vest": {
150 | "body_gear": {
151 | "body_gear": { "name": "buddy_outfit02_vest", "x": 49.99, "y": -2.14, "rotation": 94.12, "width": 61, "height": 144 }
152 | }
153 | },
154 | "mask": {
155 | "facial_gear": {
156 | "facial_gear": { "name": "buddy_outfit02_mask", "x": 0.46, "y": 0.84, "rotation": -92.29, "width": 85, "height": 114 }
157 | }
158 | }
159 | },
160 | "animations": {
161 | "idle": {
162 | "slots": {
163 | "bg": {
164 | "attachment": [
165 | { "time": 0, "name": "bg" },
166 | { "time": 1, "name": "bg" },
167 | { "time": 2, "name": "bg" }
168 | ]
169 | },
170 | "body_assets": {
171 | "attachment": [
172 | { "time": 0, "name": "body_assets" },
173 | { "time": 1, "name": "body_assets" },
174 | { "time": 2, "name": "body_assets" }
175 | ]
176 | },
177 | "body_gear": {
178 | "attachment": [
179 | { "time": 0, "name": "body_gear" },
180 | { "time": 1, "name": "body_gear" },
181 | { "time": 2, "name": "body_gear" }
182 | ]
183 | },
184 | "buddy_arm_left_rest": {
185 | "attachment": [
186 | { "time": 0, "name": null },
187 | { "time": 1, "name": null },
188 | { "time": 2, "name": null }
189 | ]
190 | },
191 | "buddy_arm_right_bottom": {
192 | "attachment": [
193 | { "time": 0, "name": null },
194 | { "time": 1.1666, "name": null },
195 | { "time": 2, "name": null }
196 | ]
197 | },
198 | "buddy_arm_right_top": {
199 | "attachment": [
200 | { "time": 0, "name": null },
201 | { "time": 1, "name": null },
202 | { "time": 2, "name": null }
203 | ]
204 | },
205 | "buddy_arm_walk_left_bottom": {
206 | "attachment": [
207 | { "time": 0, "name": "buddy_arm_walk_left_bottom" },
208 | { "time": 1.1333, "name": "buddy_arm_walk_left_bottom" },
209 | { "time": 2, "name": "buddy_arm_walk_left_bottom" }
210 | ]
211 | },
212 | "buddy_arm_walk_left_top": {
213 | "attachment": [
214 | { "time": 0, "name": "buddy_arm_walk_left_top" },
215 | { "time": 1, "name": "buddy_arm_walk_left_top" },
216 | { "time": 2, "name": "buddy_arm_walk_left_top" }
217 | ]
218 | },
219 | "buddy_arm_walk_right_bottom": {
220 | "attachment": [
221 | { "time": 0, "name": "buddy_arm_walk_right_bottom" },
222 | { "time": 1.1666, "name": "buddy_arm_walk_right_bottom" },
223 | { "time": 2, "name": "buddy_arm_walk_right_bottom" }
224 | ]
225 | },
226 | "buddy_arm_walk_right_top": {
227 | "attachment": [
228 | { "time": 0, "name": "buddy_arm_walk_right_top" },
229 | { "time": 1, "name": "buddy_arm_walk_right_top" },
230 | { "time": 2, "name": "buddy_arm_walk_right_top" }
231 | ]
232 | },
233 | "buddy_body": {
234 | "attachment": [
235 | { "time": 0, "name": "buddy_body" },
236 | { "time": 1, "name": "buddy_body" },
237 | { "time": 2, "name": "buddy_body" }
238 | ]
239 | },
240 | "buddy_brow_left": {
241 | "attachment": [
242 | { "time": 0, "name": "buddy_brow_left" },
243 | { "time": 1, "name": "buddy_brow_left" },
244 | { "time": 2, "name": "buddy_brow_left" }
245 | ]
246 | },
247 | "buddy_brow_right": {
248 | "attachment": [
249 | { "time": 0, "name": "buddy_brow_right" },
250 | { "time": 1, "name": "buddy_brow_right" },
251 | { "time": 2, "name": "buddy_brow_right" }
252 | ]
253 | },
254 | "buddy_eye_left": {
255 | "attachment": [
256 | { "time": 0, "name": "buddy_eye" },
257 | { "time": 1, "name": "buddy_eye" },
258 | { "time": 2, "name": "buddy_eye" }
259 | ]
260 | },
261 | "buddy_eye_right": {
262 | "attachment": [
263 | { "time": 0, "name": "buddy_eye" },
264 | { "time": 1, "name": "buddy_eye" },
265 | { "time": 2, "name": "buddy_eye" }
266 | ]
267 | },
268 | "buddy_face": {
269 | "attachment": [
270 | { "time": 0, "name": "buddy_face_happy" },
271 | { "time": 1, "name": "buddy_face_happy" },
272 | { "time": 2, "name": "buddy_face_happy" }
273 | ]
274 | },
275 | "buddy_foot_left": {
276 | "attachment": [
277 | { "time": 0, "name": null },
278 | { "time": 1, "name": null },
279 | { "time": 2, "name": null }
280 | ]
281 | },
282 | "buddy_foot_right": {
283 | "attachment": [
284 | { "time": 0, "name": null },
285 | { "time": 1, "name": null },
286 | { "time": 2, "name": null }
287 | ]
288 | },
289 | "buddy_hair": {
290 | "attachment": [
291 | { "time": 0, "name": "buddy_hair" },
292 | { "time": 1.3333, "name": "buddy_hair" },
293 | { "time": 2, "name": "buddy_hair" }
294 | ]
295 | },
296 | "buddy_hand_right": {
297 | "attachment": [
298 | { "time": 0, "name": null },
299 | { "time": 1, "name": null },
300 | { "time": 2, "name": null }
301 | ]
302 | },
303 | "buddy_head": {
304 | "attachment": [
305 | { "time": 0, "name": "buddy_head" },
306 | { "time": 1.1666, "name": "buddy_head" },
307 | { "time": 2, "name": "buddy_head" }
308 | ]
309 | },
310 | "buddy_leg_left_bottom": {
311 | "attachment": [
312 | { "time": 0, "name": null },
313 | { "time": 1, "name": null },
314 | { "time": 2, "name": null }
315 | ]
316 | },
317 | "buddy_leg_left_top": {
318 | "attachment": [
319 | { "time": 0, "name": null },
320 | { "time": 1, "name": null },
321 | { "time": 2, "name": null }
322 | ]
323 | },
324 | "buddy_leg_right_bottom": {
325 | "attachment": [
326 | { "time": 0, "name": null },
327 | { "time": 1, "name": null },
328 | { "time": 2, "name": null }
329 | ]
330 | },
331 | "buddy_leg_right_top": {
332 | "attachment": [
333 | { "time": 0, "name": null },
334 | { "time": 1, "name": null },
335 | { "time": 2, "name": null }
336 | ]
337 | },
338 | "buddy_legs_full": {
339 | "attachment": [
340 | { "time": 0, "name": "buddy_legs_full" },
341 | { "time": 1, "name": "buddy_legs_full" },
342 | { "time": 2, "name": "buddy_legs_full" }
343 | ]
344 | },
345 | "buddy_pelvis": {
346 | "attachment": [
347 | { "time": 0, "name": null },
348 | { "time": 1, "name": null },
349 | { "time": 2, "name": null }
350 | ]
351 | },
352 | "facial_gear": {
353 | "attachment": [
354 | { "time": 0, "name": "facial_gear" },
355 | { "time": 1.3333, "name": "facial_gear" },
356 | { "time": 2, "name": "facial_gear" }
357 | ]
358 | }
359 | },
360 | "bones": {
361 | "arm_right_top": {
362 | "rotate": [
363 | {
364 | "time": 0,
365 | "angle": 0,
366 | "curve": [ 0.25, 0, 0.75, 1 ]
367 | },
368 | {
369 | "time": 1,
370 | "angle": -6.55,
371 | "curve": [ 0.25, 0, 0.75, 1 ]
372 | },
373 | { "time": 2, "angle": 0 }
374 | ],
375 | "translate": [
376 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
377 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
378 | { "time": 2, "x": 0, "y": 0 }
379 | ],
380 | "scale": [
381 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
382 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
383 | { "time": 2, "x": 1, "y": 1 }
384 | ]
385 | },
386 | "root": {
387 | "rotate": [
388 | { "time": 0, "angle": 0, "curve": "stepped" },
389 | { "time": 1, "angle": 0, "curve": "stepped" },
390 | { "time": 2, "angle": 0 }
391 | ],
392 | "translate": [
393 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
394 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
395 | { "time": 2, "x": 0, "y": 0 }
396 | ],
397 | "scale": [
398 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
399 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
400 | { "time": 2, "x": 1, "y": 1 }
401 | ]
402 | },
403 | "legs_rest": {
404 | "rotate": [
405 | { "time": 0, "angle": 0, "curve": "stepped" },
406 | { "time": 1, "angle": 0, "curve": "stepped" },
407 | { "time": 2, "angle": 0 }
408 | ],
409 | "translate": [
410 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
411 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
412 | { "time": 2, "x": 0, "y": 0 }
413 | ],
414 | "scale": [
415 | {
416 | "time": 0,
417 | "x": 1,
418 | "y": 1,
419 | "curve": [ 0.25, 0, 0.75, 1 ]
420 | },
421 | {
422 | "time": 1,
423 | "x": 0.98,
424 | "y": 1.019,
425 | "curve": [ 0.25, 0, 0.75, 1 ]
426 | },
427 | { "time": 2, "x": 1, "y": 1 }
428 | ]
429 | },
430 | "body": {
431 | "rotate": [
432 | { "time": 0, "angle": 0, "curve": "stepped" },
433 | { "time": 1, "angle": 0, "curve": "stepped" },
434 | { "time": 2, "angle": 0 }
435 | ],
436 | "translate": [
437 | {
438 | "time": 0,
439 | "x": 0,
440 | "y": 0,
441 | "curve": [ 0.25, 0, 0.75, 1 ]
442 | },
443 | {
444 | "time": 1,
445 | "x": -1.61,
446 | "y": -0.05,
447 | "curve": [ 0.25, 0, 0.75, 1 ]
448 | },
449 | { "time": 2, "x": 0, "y": 0 }
450 | ],
451 | "scale": [
452 | {
453 | "time": 0,
454 | "x": 1,
455 | "y": 1,
456 | "curve": [ 0.25, 0, 0.75, 1 ]
457 | },
458 | {
459 | "time": 1,
460 | "x": 1.01,
461 | "y": 1.036,
462 | "curve": [ 0.25, 0, 0.75, 1 ]
463 | },
464 | { "time": 2, "x": 1, "y": 1 }
465 | ]
466 | },
467 | "arm_right_bottom": {
468 | "rotate": [
469 | {
470 | "time": 0,
471 | "angle": 0,
472 | "curve": [ 0.25, 0, 0.75, 1 ]
473 | },
474 | {
475 | "time": 1.1666,
476 | "angle": 4.86,
477 | "curve": [ 0.25, 0, 0.75, 1 ]
478 | },
479 | { "time": 2, "angle": 0 }
480 | ],
481 | "translate": [
482 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
483 | { "time": 1.1666, "x": 0, "y": 0, "curve": "stepped" },
484 | { "time": 2, "x": 0, "y": 0 }
485 | ],
486 | "scale": [
487 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
488 | { "time": 1.1666, "x": 1, "y": 1, "curve": "stepped" },
489 | { "time": 2, "x": 1, "y": 1 }
490 | ]
491 | },
492 | "hand_right": {
493 | "rotate": [
494 | { "time": 0, "angle": 0, "curve": "stepped" },
495 | { "time": 1, "angle": 0, "curve": "stepped" },
496 | { "time": 2, "angle": 0 }
497 | ],
498 | "translate": [
499 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
500 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
501 | { "time": 2, "x": 0, "y": 0 }
502 | ],
503 | "scale": [
504 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
505 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
506 | { "time": 2, "x": 1, "y": 1 }
507 | ]
508 | },
509 | "arm_left_top": {
510 | "rotate": [
511 | {
512 | "time": 0,
513 | "angle": 0,
514 | "curve": [ 0.25, 0, 0.75, 1 ]
515 | },
516 | {
517 | "time": 1,
518 | "angle": 1.43,
519 | "curve": [ 0.25, 0, 0.75, 1 ]
520 | },
521 | { "time": 2, "angle": 0 }
522 | ],
523 | "translate": [
524 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
525 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
526 | { "time": 2, "x": 0, "y": 0 }
527 | ],
528 | "scale": [
529 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
530 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
531 | { "time": 2, "x": 1, "y": 1 }
532 | ]
533 | },
534 | "arm_left_bottom": {
535 | "rotate": [
536 | {
537 | "time": 0,
538 | "angle": 0,
539 | "curve": [ 0.25, 0, 0.75, 1 ]
540 | },
541 | {
542 | "time": 1.1333,
543 | "angle": 3.6,
544 | "curve": [ 0.25, 0, 0.75, 1 ]
545 | },
546 | { "time": 2, "angle": 0 }
547 | ],
548 | "translate": [
549 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
550 | { "time": 1.1333, "x": 0, "y": 0, "curve": "stepped" },
551 | { "time": 2, "x": 0, "y": 0 }
552 | ],
553 | "scale": [
554 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
555 | { "time": 1.1333, "x": 1, "y": 1, "curve": "stepped" },
556 | { "time": 2, "x": 1, "y": 1 }
557 | ]
558 | },
559 | "head": {
560 | "rotate": [
561 | {
562 | "time": 0,
563 | "angle": 0,
564 | "curve": [ 0.25, 0, 0.75, 1 ]
565 | },
566 | {
567 | "time": 0.5,
568 | "angle": 1.61,
569 | "curve": [ 0.25, 0, 0.75, 1 ]
570 | },
571 | {
572 | "time": 1.5,
573 | "angle": -1.4,
574 | "curve": [ 0.25, 0, 0.75, 1 ]
575 | },
576 | { "time": 2, "angle": 0 }
577 | ],
578 | "translate": [
579 | {
580 | "time": 0,
581 | "x": 0,
582 | "y": 0,
583 | "curve": [ 0.25, 0, 0.75, 1 ]
584 | },
585 | {
586 | "time": 1.1666,
587 | "x": -2.66,
588 | "y": -0.15,
589 | "curve": [ 0.25, 0, 0.75, 1 ]
590 | },
591 | { "time": 2, "x": 0, "y": 0 }
592 | ],
593 | "scale": [
594 | {
595 | "time": 0,
596 | "x": 1,
597 | "y": 1,
598 | "curve": [ 0.25, 0, 0.75, 1 ]
599 | },
600 | {
601 | "time": 1.1666,
602 | "x": 1,
603 | "y": 0.984,
604 | "curve": [ 0.25, 0, 0.75, 1 ]
605 | },
606 | { "time": 2, "x": 1, "y": 1 }
607 | ]
608 | },
609 | "hair": {
610 | "rotate": [
611 | {
612 | "time": 0,
613 | "angle": 0,
614 | "curve": [ 0.25, 0, 0.75, 1 ]
615 | },
616 | {
617 | "time": 0.5,
618 | "angle": 1.5,
619 | "curve": [ 0.25, 0, 0.75, 1 ]
620 | },
621 | {
622 | "time": 1.3333,
623 | "angle": -1.65,
624 | "curve": [ 0.25, 0, 0.75, 1 ]
625 | },
626 | { "time": 2, "angle": 0 }
627 | ],
628 | "translate": [
629 | {
630 | "time": 0,
631 | "x": 0,
632 | "y": 0,
633 | "curve": [ 0.25, 0, 0.75, 1 ]
634 | },
635 | {
636 | "time": 0.5,
637 | "x": -0.49,
638 | "y": 0.03,
639 | "curve": [ 0.25, 0, 0.75, 1 ]
640 | },
641 | {
642 | "time": 1.3333,
643 | "x": -0.99,
644 | "y": 0.02,
645 | "curve": [ 0.25, 0, 0.75, 1 ]
646 | },
647 | { "time": 2, "x": 0, "y": 0 }
648 | ],
649 | "scale": [
650 | {
651 | "time": 0,
652 | "x": 1,
653 | "y": 1,
654 | "curve": [ 0.25, 0, 0.75, 1 ]
655 | },
656 | {
657 | "time": 0.5,
658 | "x": 0.924,
659 | "y": 1,
660 | "curve": [ 0.25, 0, 0.75, 1 ]
661 | },
662 | {
663 | "time": 1.3333,
664 | "x": 1.028,
665 | "y": 1,
666 | "curve": [ 0.25, 0, 0.75, 1 ]
667 | },
668 | { "time": 2, "x": 1, "y": 1 }
669 | ]
670 | },
671 | "brow_left": {
672 | "rotate": [
673 | { "time": 0, "angle": 0, "curve": "stepped" },
674 | { "time": 1, "angle": 0, "curve": "stepped" },
675 | { "time": 2, "angle": 0 }
676 | ],
677 | "translate": [
678 | {
679 | "time": 0,
680 | "x": 0,
681 | "y": 0,
682 | "curve": [ 0.25, 0, 0.75, 1 ]
683 | },
684 | {
685 | "time": 1,
686 | "x": 4.79,
687 | "y": -0.21,
688 | "curve": [ 0.25, 0, 0.75, 1 ]
689 | },
690 | { "time": 2, "x": 0, "y": 0 }
691 | ],
692 | "scale": [
693 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
694 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
695 | { "time": 2, "x": 1, "y": 1 }
696 | ]
697 | },
698 | "brow_right": {
699 | "rotate": [
700 | { "time": 0, "angle": 0, "curve": "stepped" },
701 | { "time": 1, "angle": 0, "curve": "stepped" },
702 | { "time": 2, "angle": 0 }
703 | ],
704 | "translate": [
705 | {
706 | "time": 0,
707 | "x": 0,
708 | "y": 0,
709 | "curve": [ 0.25, 0, 0.75, 1 ]
710 | },
711 | {
712 | "time": 1.1666,
713 | "x": 4.79,
714 | "y": -0.21,
715 | "curve": [ 0.25, 0, 0.75, 1 ]
716 | },
717 | { "time": 2, "x": 0, "y": 0 }
718 | ],
719 | "scale": [
720 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
721 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
722 | { "time": 2, "x": 1, "y": 1 }
723 | ]
724 | },
725 | "eye_left": {
726 | "rotate": [
727 | { "time": 0, "angle": 0, "curve": "stepped" },
728 | { "time": 1, "angle": 0, "curve": "stepped" },
729 | { "time": 2, "angle": 0 }
730 | ],
731 | "translate": [
732 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
733 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
734 | { "time": 2, "x": 0, "y": 0 }
735 | ],
736 | "scale": [
737 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
738 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
739 | {
740 | "time": 1.1666,
741 | "x": 1,
742 | "y": 1,
743 | "curve": [ 0.25, 0, 0.75, 1 ]
744 | },
745 | {
746 | "time": 1.2333,
747 | "x": 0.147,
748 | "y": 1,
749 | "curve": [ 0.25, 0, 0.75, 1 ]
750 | },
751 | { "time": 1.3, "x": 1, "y": 1, "curve": "stepped" },
752 | { "time": 2, "x": 1, "y": 1 }
753 | ]
754 | },
755 | "eye_right": {
756 | "rotate": [
757 | { "time": 0, "angle": 0, "curve": "stepped" },
758 | { "time": 1, "angle": 0, "curve": "stepped" },
759 | { "time": 2, "angle": 0 }
760 | ],
761 | "translate": [
762 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
763 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
764 | { "time": 2, "x": 0, "y": 0 }
765 | ],
766 | "scale": [
767 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
768 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
769 | {
770 | "time": 1.1666,
771 | "x": 1,
772 | "y": 1,
773 | "curve": [ 0.25, 0, 0.75, 1 ]
774 | },
775 | {
776 | "time": 1.2333,
777 | "x": 0.133,
778 | "y": 1,
779 | "curve": [ 0.25, 0, 0.75, 1 ]
780 | },
781 | { "time": 1.3, "x": 1, "y": 1, "curve": "stepped" },
782 | { "time": 2, "x": 1, "y": 1 }
783 | ]
784 | },
785 | "face": {
786 | "rotate": [
787 | { "time": 0, "angle": 0, "curve": "stepped" },
788 | { "time": 1, "angle": 0, "curve": "stepped" },
789 | { "time": 2, "angle": 0 }
790 | ],
791 | "translate": [
792 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
793 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
794 | { "time": 2, "x": 0, "y": 0 }
795 | ],
796 | "scale": [
797 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
798 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
799 | { "time": 2, "x": 1, "y": 1 }
800 | ]
801 | },
802 | "facial_gear": {
803 | "rotate": [
804 | {
805 | "time": 0,
806 | "angle": 0,
807 | "curve": [ 0.25, 0, 0.75, 1 ]
808 | },
809 | {
810 | "time": 1.3333,
811 | "angle": -1.44,
812 | "curve": [ 0.25, 0, 0.75, 1 ]
813 | },
814 | { "time": 2, "angle": 0 }
815 | ],
816 | "translate": [
817 | {
818 | "time": 0,
819 | "x": 0,
820 | "y": 0,
821 | "curve": [ 0.25, 0, 0.75, 1 ]
822 | },
823 | {
824 | "time": 1.3333,
825 | "x": -1.76,
826 | "y": 0.08,
827 | "curve": [ 0.25, 0, 0.75, 1 ]
828 | },
829 | { "time": 2, "x": 0, "y": 0 }
830 | ],
831 | "scale": [
832 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
833 | { "time": 1.3333, "x": 1, "y": 1, "curve": "stepped" },
834 | { "time": 2, "x": 1, "y": 1 }
835 | ]
836 | },
837 | "body_gear": {
838 | "rotate": [
839 | {
840 | "time": 0,
841 | "angle": 0,
842 | "curve": [ 0.25, 0, 0.75, 1 ]
843 | },
844 | {
845 | "time": 1,
846 | "angle": -357.59,
847 | "curve": [ 0.25, 0, 0.75, 1 ]
848 | },
849 | { "time": 2, "angle": 0 }
850 | ],
851 | "translate": [
852 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
853 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
854 | { "time": 2, "x": 0, "y": 0 }
855 | ],
856 | "scale": [
857 | {
858 | "time": 0,
859 | "x": 1,
860 | "y": 1,
861 | "curve": [ 0.25, 0, 0.75, 1 ]
862 | },
863 | {
864 | "time": 1,
865 | "x": 1.017,
866 | "y": 1,
867 | "curve": [ 0.25, 0, 0.75, 1 ]
868 | },
869 | { "time": 2, "x": 1, "y": 1 }
870 | ]
871 | },
872 | "pelvis": {
873 | "rotate": [
874 | { "time": 0, "angle": 0, "curve": "stepped" },
875 | { "time": 1, "angle": 0, "curve": "stepped" },
876 | { "time": 2, "angle": 0 }
877 | ],
878 | "translate": [
879 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
880 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
881 | { "time": 2, "x": 0, "y": 0 }
882 | ],
883 | "scale": [
884 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
885 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
886 | { "time": 2, "x": 1, "y": 1 }
887 | ]
888 | },
889 | "leg_right_top": {
890 | "rotate": [
891 | { "time": 0, "angle": 0, "curve": "stepped" },
892 | { "time": 1, "angle": 0, "curve": "stepped" },
893 | { "time": 2, "angle": 0 }
894 | ],
895 | "translate": [
896 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
897 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
898 | { "time": 2, "x": 0, "y": 0 }
899 | ],
900 | "scale": [
901 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
902 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
903 | { "time": 2, "x": 1, "y": 1 }
904 | ]
905 | },
906 | "leg_right_bottom": {
907 | "rotate": [
908 | { "time": 0, "angle": 0, "curve": "stepped" },
909 | { "time": 1, "angle": 0, "curve": "stepped" },
910 | { "time": 2, "angle": 0 }
911 | ],
912 | "translate": [
913 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
914 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
915 | { "time": 2, "x": 0, "y": 0 }
916 | ],
917 | "scale": [
918 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
919 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
920 | { "time": 2, "x": 1, "y": 1 }
921 | ]
922 | },
923 | "foot_right": {
924 | "rotate": [
925 | { "time": 0, "angle": 0, "curve": "stepped" },
926 | { "time": 1, "angle": 0, "curve": "stepped" },
927 | { "time": 2, "angle": 0 }
928 | ],
929 | "translate": [
930 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
931 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
932 | { "time": 2, "x": 0, "y": 0 }
933 | ],
934 | "scale": [
935 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
936 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
937 | { "time": 2, "x": 1, "y": 1 }
938 | ]
939 | },
940 | "leg_left_top": {
941 | "rotate": [
942 | { "time": 0, "angle": 0, "curve": "stepped" },
943 | { "time": 1, "angle": 0, "curve": "stepped" },
944 | { "time": 2, "angle": 0 }
945 | ],
946 | "translate": [
947 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
948 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
949 | { "time": 2, "x": 0, "y": 0 }
950 | ],
951 | "scale": [
952 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
953 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
954 | { "time": 2, "x": 1, "y": 1 }
955 | ]
956 | },
957 | "leg_left_bottom": {
958 | "rotate": [
959 | { "time": 0, "angle": 0, "curve": "stepped" },
960 | { "time": 1, "angle": 0, "curve": "stepped" },
961 | { "time": 2, "angle": 0 }
962 | ],
963 | "translate": [
964 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
965 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
966 | { "time": 2, "x": 0, "y": 0 }
967 | ],
968 | "scale": [
969 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
970 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
971 | { "time": 2, "x": 1, "y": 1 }
972 | ]
973 | },
974 | "foot_left": {
975 | "rotate": [
976 | { "time": 0, "angle": 0, "curve": "stepped" },
977 | { "time": 1, "angle": 0, "curve": "stepped" },
978 | { "time": 2, "angle": 0 }
979 | ],
980 | "translate": [
981 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
982 | { "time": 1, "x": 0, "y": 0, "curve": "stepped" },
983 | { "time": 2, "x": 0, "y": 0 }
984 | ],
985 | "scale": [
986 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
987 | { "time": 1, "x": 1, "y": 1, "curve": "stepped" },
988 | { "time": 2, "x": 1, "y": 1 }
989 | ]
990 | }
991 | },
992 | "drawOrder": [
993 | { "time": 0 },
994 | { "time": 1 },
995 | { "time": 2 }
996 | ]
997 | }
998 | }
999 | }
--------------------------------------------------------------------------------
/example/assets/spineboy-old.json:
--------------------------------------------------------------------------------
1 | {
2 | "bones": [
3 | { "name": "root" },
4 | { "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
5 | { "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
6 | { "name": "left lower leg", "parent": "left upper leg", "length": 56.45, "x": 51.78, "y": 3.46, "rotation": -16.65 },
7 | { "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 64.02, "y": -8.67, "rotation": 102.43 },
8 | { "name": "right upper leg", "parent": "hip", "length": 45.76, "x": -18.27, "rotation": -101.13 },
9 | { "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 50.21, "y": 0.6, "rotation": -10.7 },
10 | { "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
11 | { "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 94.95 },
12 | { "name": "neck", "parent": "torso", "length": 18.38, "x": 83.64, "y": -1.78, "rotation": 0.9 },
13 | { "name": "head", "parent": "neck", "length": 68.28, "x": 19.09, "y": 6.97, "rotation": -8.94 },
14 | { "name": "right shoulder", "parent": "torso", "length": 49.95, "x": 81.9, "y": 6.79, "rotation": 130.6 },
15 | { "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 49.95, "y": -0.12, "rotation": 40.12 },
16 | { "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
17 | { "name": "left shoulder", "parent": "torso", "length": 44.19, "x": 78.96, "y": -15.75, "rotation": -156.96 },
18 | { "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 44.19, "y": -0.01, "rotation": 28.16 },
19 | { "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
20 | { "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 }
21 | ],
22 | "slots": [
23 | { "name": "left shoulder", "bone": "left shoulder", "attachment": "left-shoulder" },
24 | { "name": "left arm", "bone": "left arm", "attachment": "left-arm" },
25 | { "name": "left hand", "bone": "left hand", "attachment": "left-hand" },
26 | { "name": "left foot", "bone": "left foot", "attachment": "left-foot" },
27 | { "name": "left lower leg", "bone": "left lower leg", "attachment": "left-lower-leg" },
28 | { "name": "left upper leg", "bone": "left upper leg", "attachment": "left-upper-leg" },
29 | { "name": "pelvis", "bone": "pelvis", "attachment": "pelvis" },
30 | { "name": "right foot", "bone": "right foot", "attachment": "right-foot" },
31 | { "name": "right lower leg", "bone": "right lower leg", "attachment": "right-lower-leg" },
32 | { "name": "right upper leg", "bone": "right upper leg", "attachment": "right-upper-leg" },
33 | { "name": "torso", "bone": "torso", "attachment": "torso" },
34 | { "name": "neck", "bone": "neck", "attachment": "neck" },
35 | { "name": "head", "bone": "head", "attachment": "head" },
36 | { "name": "eyes", "bone": "head", "attachment": "eyes" },
37 | { "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder" },
38 | { "name": "right arm", "bone": "right arm", "attachment": "right-arm" },
39 | { "name": "right hand", "bone": "right hand", "attachment": "right-hand" }
40 | ],
41 | "skins": {
42 | "default": {
43 | "left shoulder": {
44 | "left-shoulder": { "x": 23.74, "y": 0.11, "rotation": 62.01, "width": 34, "height": 53 }
45 | },
46 | "left arm": {
47 | "left-arm": { "x": 15.11, "y": -0.44, "rotation": 33.84, "width": 35, "height": 29 }
48 | },
49 | "left hand": {
50 | "left-hand": { "x": 0.75, "y": 1.86, "rotation": 31.14, "width": 35, "height": 38 }
51 | },
52 | "left foot": {
53 | "left-foot": { "x": 24.35, "y": 8.88, "rotation": 3.32, "width": 65, "height": 30 }
54 | },
55 | "left lower leg": {
56 | "left-lower-leg": { "x": 24.55, "y": -1.92, "rotation": 105.75, "width": 49, "height": 64 }
57 | },
58 | "left upper leg": {
59 | "left-upper-leg": { "x": 26.12, "y": -1.85, "rotation": 89.09, "width": 33, "height": 67 }
60 | },
61 | "pelvis": {
62 | "pelvis": { "x": -4.83, "y": 10.62, "width": 63, "height": 47 }
63 | },
64 | "right foot": {
65 | "right-foot": { "x": 19.02, "y": 8.47, "rotation": 1.52, "width": 67, "height": 30 }
66 | },
67 | "right lower leg": {
68 | "right-lower-leg": { "x": 23.28, "y": -2.59, "rotation": 111.83, "width": 51, "height": 64 }
69 | },
70 | "right upper leg": {
71 | "right-upper-leg": { "x": 23.03, "y": 0.25, "rotation": 101.13, "width": 44, "height": 70 }
72 | },
73 | "torso": {
74 | "torso": { "x": 44.57, "y": -7.08, "rotation": -94.95, "width": 68, "height": 92 }
75 | },
76 | "neck": {
77 | "neck": { "x": 9.42, "y": -3.66, "rotation": -100.15, "width": 34, "height": 28 }
78 | },
79 | "head": {
80 | "head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 }
81 | },
82 | "eyes": {
83 | "eyes": { "x": 28.94, "y": -32.92, "rotation": -86.9, "width": 34, "height": 27 },
84 | "eyes-closed": { "x": 28.77, "y": -32.86, "rotation": -86.9, "width": 34, "height": 27 }
85 | },
86 | "right shoulder": {
87 | "right-shoulder": { "x": 25.86, "y": 0.03, "rotation": 134.44, "width": 52, "height": 51 }
88 | },
89 | "right arm": {
90 | "right-arm": { "x": 18.34, "y": -2.64, "rotation": 94.32, "width": 21, "height": 45 }
91 | },
92 | "right hand": {
93 | "right-hand": { "x": 6.82, "y": 1.25, "rotation": 91.96, "width": 32, "height": 32 }
94 | }
95 | }
96 | },
97 | "animations": {
98 | "walk": {
99 | "bones": {
100 | "left upper leg": {
101 | "rotate": [
102 | { "time": 0, "angle": -26.55 },
103 | { "time": 0.1333, "angle": -8.78 },
104 | { "time": 0.2666, "angle": 9.51 },
105 | { "time": 0.4, "angle": 30.74 },
106 | { "time": 0.5333, "angle": 25.33 },
107 | { "time": 0.6666, "angle": 26.11 },
108 | { "time": 0.8, "angle": -7.7 },
109 | { "time": 0.9333, "angle": -21.19 },
110 | { "time": 1.0666, "angle": -26.55 }
111 | ],
112 | "translate": [
113 | { "time": 0, "x": -3, "y": -2.25 },
114 | { "time": 0.4, "x": -2.18, "y": -2.25 },
115 | { "time": 1.0666, "x": -3, "y": -2.25 }
116 | ]
117 | },
118 | "right upper leg": {
119 | "rotate": [
120 | { "time": 0, "angle": 42.45 },
121 | { "time": 0.1333, "angle": 52.1 },
122 | { "time": 0.2666, "angle": 5.96 },
123 | { "time": 0.5333, "angle": -16.93 },
124 | { "time": 0.6666, "angle": 1.89 },
125 | {
126 | "time": 0.8,
127 | "angle": 28.06,
128 | "curve": [ 0.462, 0.11, 1, 1 ]
129 | },
130 | {
131 | "time": 0.9333,
132 | "angle": 58.68,
133 | "curve": [ 0.5, 0.02, 1, 1 ]
134 | },
135 | { "time": 1.0666, "angle": 42.45 }
136 | ],
137 | "translate": [
138 | { "time": 0, "x": 8.11, "y": -2.36 },
139 | { "time": 0.1333, "x": 10.03, "y": -2.56 },
140 | { "time": 0.4, "x": 2.76, "y": -2.97 },
141 | { "time": 0.5333, "x": 2.76, "y": -2.81 },
142 | { "time": 0.9333, "x": 8.67, "y": -2.54 },
143 | { "time": 1.0666, "x": 8.11, "y": -2.36 }
144 | ]
145 | },
146 | "left lower leg": {
147 | "rotate": [
148 | { "time": 0, "angle": -10.21 },
149 | { "time": 0.1333, "angle": -55.64 },
150 | { "time": 0.2666, "angle": -68.12 },
151 | { "time": 0.5333, "angle": 5.11 },
152 | { "time": 0.6666, "angle": -28.29 },
153 | { "time": 0.8, "angle": 4.08 },
154 | { "time": 0.9333, "angle": 3.53 },
155 | { "time": 1.0666, "angle": -10.21 }
156 | ]
157 | },
158 | "left foot": {
159 | "rotate": [
160 | { "time": 0, "angle": -3.69 },
161 | { "time": 0.1333, "angle": -10.42 },
162 | { "time": 0.2666, "angle": -17.14 },
163 | { "time": 0.4, "angle": -2.83 },
164 | { "time": 0.5333, "angle": -3.87 },
165 | { "time": 0.6666, "angle": 2.78 },
166 | { "time": 0.8, "angle": 1.68 },
167 | { "time": 0.9333, "angle": -8.54 },
168 | { "time": 1.0666, "angle": -3.69 }
169 | ]
170 | },
171 | "right shoulder": {
172 | "rotate": [
173 | {
174 | "time": 0,
175 | "angle": 20.89,
176 | "curve": [ 0.264, 0, 0.75, 1 ]
177 | },
178 | {
179 | "time": 0.1333,
180 | "angle": 3.72,
181 | "curve": [ 0.272, 0, 0.841, 1 ]
182 | },
183 | { "time": 0.6666, "angle": -278.28 },
184 | { "time": 1.0666, "angle": 20.89 }
185 | ],
186 | "translate": [
187 | { "time": 0, "x": -7.84, "y": 7.19 },
188 | { "time": 0.1333, "x": -6.36, "y": 6.42 },
189 | { "time": 0.6666, "x": -11.07, "y": 5.25 },
190 | { "time": 1.0666, "x": -7.84, "y": 7.19 }
191 | ]
192 | },
193 | "right arm": {
194 | "rotate": [
195 | {
196 | "time": 0,
197 | "angle": -4.02,
198 | "curve": [ 0.267, 0, 0.804, 0.99 ]
199 | },
200 | {
201 | "time": 0.1333,
202 | "angle": -13.99,
203 | "curve": [ 0.341, 0, 1, 1 ]
204 | },
205 | {
206 | "time": 0.6666,
207 | "angle": 36.54,
208 | "curve": [ 0.307, 0, 0.787, 0.99 ]
209 | },
210 | { "time": 1.0666, "angle": -4.02 }
211 | ]
212 | },
213 | "right hand": {
214 | "rotate": [
215 | { "time": 0, "angle": 22.92 },
216 | { "time": 0.4, "angle": -8.97 },
217 | { "time": 0.6666, "angle": 0.51 },
218 | { "time": 1.0666, "angle": 22.92 }
219 | ]
220 | },
221 | "left shoulder": {
222 | "rotate": [
223 | { "time": 0, "angle": -1.47 },
224 | { "time": 0.1333, "angle": 13.6 },
225 | { "time": 0.6666, "angle": 280.74 },
226 | { "time": 1.0666, "angle": -1.47 }
227 | ],
228 | "translate": [
229 | { "time": 0, "x": -1.76, "y": 0.56 },
230 | { "time": 0.6666, "x": -2.47, "y": 8.14 },
231 | { "time": 1.0666, "x": -1.76, "y": 0.56 }
232 | ]
233 | },
234 | "left hand": {
235 | "rotate": [
236 | {
237 | "time": 0,
238 | "angle": 11.58,
239 | "curve": [ 0.169, 0.37, 0.632, 1.55 ]
240 | },
241 | {
242 | "time": 0.1333,
243 | "angle": 28.13,
244 | "curve": [ 0.692, 0, 0.692, 0.99 ]
245 | },
246 | {
247 | "time": 0.6666,
248 | "angle": -27.42,
249 | "curve": [ 0.117, 0.41, 0.738, 1.76 ]
250 | },
251 | { "time": 0.8, "angle": -36.32 },
252 | { "time": 1.0666, "angle": 11.58 }
253 | ]
254 | },
255 | "left arm": {
256 | "rotate": [
257 | { "time": 0, "angle": -8.27 },
258 | { "time": 0.1333, "angle": 18.43 },
259 | { "time": 0.6666, "angle": 0.88 },
260 | { "time": 1.0666, "angle": -8.27 }
261 | ]
262 | },
263 | "torso": {
264 | "rotate": [
265 | { "time": 0, "angle": -10.28 },
266 | {
267 | "time": 0.1333,
268 | "angle": -15.38,
269 | "curve": [ 0.545, 0, 1, 1 ]
270 | },
271 | {
272 | "time": 0.4,
273 | "angle": -9.78,
274 | "curve": [ 0.58, 0.17, 1, 1 ]
275 | },
276 | { "time": 0.6666, "angle": -15.75 },
277 | { "time": 0.9333, "angle": -7.06 },
278 | { "time": 1.0666, "angle": -10.28 }
279 | ],
280 | "translate": [
281 | { "time": 0, "x": -3.67, "y": 1.68 },
282 | { "time": 0.1333, "x": -3.67, "y": 0.68 },
283 | { "time": 0.4, "x": -3.67, "y": 1.97 },
284 | { "time": 0.6666, "x": -3.67, "y": -0.14 },
285 | { "time": 1.0666, "x": -3.67, "y": 1.68 }
286 | ]
287 | },
288 | "right foot": {
289 | "rotate": [
290 | { "time": 0, "angle": -5.25 },
291 | { "time": 0.2666, "angle": -4.08 },
292 | { "time": 0.4, "angle": -6.45 },
293 | { "time": 0.5333, "angle": -5.39 },
294 | { "time": 0.8, "angle": -11.68 },
295 | { "time": 0.9333, "angle": 0.46 },
296 | { "time": 1.0666, "angle": -5.25 }
297 | ]
298 | },
299 | "right lower leg": {
300 | "rotate": [
301 | { "time": 0, "angle": -3.39 },
302 | { "time": 0.1333, "angle": -45.53 },
303 | { "time": 0.2666, "angle": -2.59 },
304 | { "time": 0.5333, "angle": -19.53 },
305 | { "time": 0.6666, "angle": -64.8 },
306 | {
307 | "time": 0.8,
308 | "angle": -82.56,
309 | "curve": [ 0.557, 0.18, 1, 1 ]
310 | },
311 | { "time": 1.0666, "angle": -3.39 }
312 | ]
313 | },
314 | "hip": {
315 | "rotate": [
316 | { "time": 0, "angle": 0, "curve": "stepped" },
317 | { "time": 1.0666, "angle": 0 }
318 | ],
319 | "translate": [
320 | { "time": 0, "x": 0, "y": 0 },
321 | {
322 | "time": 0.1333,
323 | "x": 0,
324 | "y": -7.61,
325 | "curve": [ 0.272, 0.86, 1, 1 ]
326 | },
327 | { "time": 0.4, "x": 0, "y": 8.7 },
328 | { "time": 0.5333, "x": 0, "y": -0.41 },
329 | {
330 | "time": 0.6666,
331 | "x": 0,
332 | "y": -7.05,
333 | "curve": [ 0.235, 0.89, 1, 1 ]
334 | },
335 | { "time": 0.8, "x": 0, "y": 2.92 },
336 | { "time": 0.9333, "x": 0, "y": 6.78 },
337 | { "time": 1.0666, "x": 0, "y": 0 }
338 | ]
339 | },
340 | "neck": {
341 | "rotate": [
342 | { "time": 0, "angle": 3.6 },
343 | { "time": 0.1333, "angle": 17.49 },
344 | { "time": 0.2666, "angle": 6.1 },
345 | { "time": 0.4, "angle": 3.45 },
346 | { "time": 0.5333, "angle": 5.17 },
347 | { "time": 0.6666, "angle": 18.36 },
348 | { "time": 0.8, "angle": 6.09 },
349 | { "time": 0.9333, "angle": 2.28 },
350 | { "time": 1.0666, "angle": 3.6 }
351 | ]
352 | },
353 | "head": {
354 | "rotate": [
355 | {
356 | "time": 0,
357 | "angle": 3.6,
358 | "curve": [ 0, 0, 0.704, 1.61 ]
359 | },
360 | { "time": 0.1666, "angle": -0.2 },
361 | { "time": 0.2666, "angle": 6.1 },
362 | { "time": 0.4, "angle": 3.45 },
363 | {
364 | "time": 0.5333,
365 | "angle": 5.17,
366 | "curve": [ 0, 0, 0.704, 1.61 ]
367 | },
368 | { "time": 0.7, "angle": 1.1 },
369 | { "time": 0.8, "angle": 6.09 },
370 | { "time": 0.9333, "angle": 2.28 },
371 | { "time": 1.0666, "angle": 3.6 }
372 | ]
373 | }
374 | }
375 | },
376 | "jump": {
377 | "bones": {
378 | "hip": {
379 | "rotate": [
380 | { "time": 0, "angle": 0, "curve": "stepped" },
381 | { "time": 0.9333, "angle": 0, "curve": "stepped" },
382 | { "time": 1.3666, "angle": 0 }
383 | ],
384 | "translate": [
385 | { "time": 0, "x": -11.57, "y": -3 },
386 | { "time": 0.2333, "x": -16.2, "y": -19.43 },
387 | {
388 | "time": 0.3333,
389 | "x": 7.66,
390 | "y": -8.48,
391 | "curve": [ 0.057, 0.06, 0.712, 1 ]
392 | },
393 | { "time": 0.3666, "x": 15.38, "y": 5.01 },
394 | { "time": 0.4666, "x": -7.84, "y": 57.22 },
395 | {
396 | "time": 0.6,
397 | "x": -10.81,
398 | "y": 96.34,
399 | "curve": [ 0.241, 0, 1, 1 ]
400 | },
401 | { "time": 0.7333, "x": -7.01, "y": 54.7 },
402 | { "time": 0.8, "x": -10.58, "y": 32.2 },
403 | { "time": 0.9333, "x": -31.99, "y": 0.45 },
404 | { "time": 1.0666, "x": -12.48, "y": -29.47 },
405 | { "time": 1.3666, "x": -11.57, "y": -3 }
406 | ],
407 | "scale": [
408 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
409 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
410 | { "time": 1.3666, "x": 1, "y": 1 }
411 | ]
412 | },
413 | "left upper leg": {
414 | "rotate": [
415 | { "time": 0, "angle": 17.13 },
416 | { "time": 0.2333, "angle": 44.35 },
417 | { "time": 0.3333, "angle": 16.46 },
418 | { "time": 0.4, "angle": -9.88 },
419 | { "time": 0.4666, "angle": -11.42 },
420 | { "time": 0.5666, "angle": 23.46 },
421 | { "time": 0.7666, "angle": 71.82 },
422 | { "time": 0.9333, "angle": 65.53 },
423 | { "time": 1.0666, "angle": 51.01 },
424 | { "time": 1.3666, "angle": 17.13 }
425 | ],
426 | "translate": [
427 | { "time": 0, "x": -3, "y": -2.25, "curve": "stepped" },
428 | { "time": 0.9333, "x": -3, "y": -2.25, "curve": "stepped" },
429 | { "time": 1.3666, "x": -3, "y": -2.25 }
430 | ],
431 | "scale": [
432 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
433 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
434 | { "time": 1.3666, "x": 1, "y": 1 }
435 | ]
436 | },
437 | "left lower leg": {
438 | "rotate": [
439 | { "time": 0, "angle": -16.25 },
440 | { "time": 0.2333, "angle": -52.21 },
441 | { "time": 0.4, "angle": 15.04 },
442 | { "time": 0.4666, "angle": -8.95 },
443 | { "time": 0.5666, "angle": -39.53 },
444 | { "time": 0.7666, "angle": -27.27 },
445 | { "time": 0.9333, "angle": -3.52 },
446 | { "time": 1.0666, "angle": -61.92 },
447 | { "time": 1.3666, "angle": -16.25 }
448 | ],
449 | "translate": [
450 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
451 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
452 | { "time": 1.3666, "x": 0, "y": 0 }
453 | ],
454 | "scale": [
455 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
456 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
457 | { "time": 1.3666, "x": 1, "y": 1 }
458 | ]
459 | },
460 | "left foot": {
461 | "rotate": [
462 | { "time": 0, "angle": 0.33 },
463 | { "time": 0.2333, "angle": 6.2 },
464 | { "time": 0.3333, "angle": 14.73 },
465 | { "time": 0.4, "angle": -15.54 },
466 | { "time": 0.4333, "angle": -21.2 },
467 | { "time": 0.5666, "angle": -7.55 },
468 | { "time": 0.7666, "angle": -0.67 },
469 | { "time": 0.9333, "angle": -0.58 },
470 | { "time": 1.0666, "angle": 14.64 },
471 | { "time": 1.3666, "angle": 0.33 }
472 | ],
473 | "translate": [
474 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
475 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
476 | { "time": 1.3666, "x": 0, "y": 0 }
477 | ],
478 | "scale": [
479 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
480 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
481 | { "time": 1.3666, "x": 1, "y": 1 }
482 | ]
483 | },
484 | "right upper leg": {
485 | "rotate": [
486 | { "time": 0, "angle": 25.97 },
487 | { "time": 0.2333, "angle": 46.43 },
488 | { "time": 0.3333, "angle": 22.61 },
489 | { "time": 0.4, "angle": 2.13 },
490 | {
491 | "time": 0.4666,
492 | "angle": 0.04,
493 | "curve": [ 0, 0, 0.637, 0.98 ]
494 | },
495 | { "time": 0.6, "angle": 65.55 },
496 | { "time": 0.7666, "angle": 64.93 },
497 | { "time": 0.9333, "angle": 41.08 },
498 | { "time": 1.0666, "angle": 66.25 },
499 | { "time": 1.3666, "angle": 25.97 }
500 | ],
501 | "translate": [
502 | { "time": 0, "x": 5.74, "y": 0.61 },
503 | { "time": 0.2333, "x": 4.79, "y": 1.79 },
504 | { "time": 0.3333, "x": 6.05, "y": -4.55 },
505 | { "time": 0.9333, "x": 4.79, "y": 1.79, "curve": "stepped" },
506 | { "time": 1.0666, "x": 4.79, "y": 1.79 },
507 | { "time": 1.3666, "x": 5.74, "y": 0.61 }
508 | ],
509 | "scale": [
510 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
511 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
512 | { "time": 1.3666, "x": 1, "y": 1 }
513 | ]
514 | },
515 | "right lower leg": {
516 | "rotate": [
517 | { "time": 0, "angle": -27.46 },
518 | { "time": 0.2333, "angle": -64.03 },
519 | { "time": 0.4, "angle": -48.36 },
520 | { "time": 0.5666, "angle": -76.86 },
521 | { "time": 0.7666, "angle": -26.89 },
522 | { "time": 0.9, "angle": -18.97 },
523 | { "time": 0.9333, "angle": -14.18 },
524 | { "time": 1.0666, "angle": -80.45 },
525 | { "time": 1.3666, "angle": -27.46 }
526 | ],
527 | "translate": [
528 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
529 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
530 | { "time": 1.3666, "x": 0, "y": 0 }
531 | ],
532 | "scale": [
533 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
534 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
535 | { "time": 1.3666, "x": 1, "y": 1 }
536 | ]
537 | },
538 | "right foot": {
539 | "rotate": [
540 | { "time": 0, "angle": 1.08 },
541 | { "time": 0.2333, "angle": 16.02 },
542 | { "time": 0.3, "angle": 12.94 },
543 | { "time": 0.3333, "angle": 15.16 },
544 | { "time": 0.4, "angle": -14.7 },
545 | { "time": 0.4333, "angle": -12.85 },
546 | { "time": 0.4666, "angle": -19.18 },
547 | { "time": 0.5666, "angle": -15.82 },
548 | { "time": 0.6, "angle": -3.59 },
549 | { "time": 0.7666, "angle": -3.56 },
550 | { "time": 0.9333, "angle": 1.86 },
551 | { "time": 1.0666, "angle": 16.02 },
552 | { "time": 1.3666, "angle": 1.08 }
553 | ],
554 | "translate": [
555 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
556 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
557 | { "time": 1.3666, "x": 0, "y": 0 }
558 | ],
559 | "scale": [
560 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
561 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
562 | { "time": 1.3666, "x": 1, "y": 1 }
563 | ]
564 | },
565 | "torso": {
566 | "rotate": [
567 | { "time": 0, "angle": -13.35 },
568 | { "time": 0.2333, "angle": -48.95 },
569 | { "time": 0.4333, "angle": -35.77 },
570 | { "time": 0.6, "angle": -4.59 },
571 | { "time": 0.7666, "angle": 14.61 },
572 | { "time": 0.9333, "angle": 15.74 },
573 | { "time": 1.0666, "angle": -32.44 },
574 | { "time": 1.3666, "angle": -13.35 }
575 | ],
576 | "translate": [
577 | { "time": 0, "x": -3.67, "y": 1.68, "curve": "stepped" },
578 | { "time": 0.9333, "x": -3.67, "y": 1.68, "curve": "stepped" },
579 | { "time": 1.3666, "x": -3.67, "y": 1.68 }
580 | ],
581 | "scale": [
582 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
583 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
584 | { "time": 1.3666, "x": 1, "y": 1 }
585 | ]
586 | },
587 | "neck": {
588 | "rotate": [
589 | { "time": 0, "angle": 12.78 },
590 | { "time": 0.2333, "angle": 16.46 },
591 | { "time": 0.4, "angle": 26.49 },
592 | { "time": 0.6, "angle": 15.51 },
593 | { "time": 0.7666, "angle": 1.34 },
594 | { "time": 0.9333, "angle": 2.35 },
595 | { "time": 1.0666, "angle": 6.08 },
596 | { "time": 1.3, "angle": 21.23 },
597 | { "time": 1.3666, "angle": 12.78 }
598 | ],
599 | "translate": [
600 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
601 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
602 | { "time": 1.3666, "x": 0, "y": 0 }
603 | ],
604 | "scale": [
605 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
606 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
607 | { "time": 1.3666, "x": 1, "y": 1 }
608 | ]
609 | },
610 | "head": {
611 | "rotate": [
612 | { "time": 0, "angle": 5.19 },
613 | { "time": 0.2333, "angle": 20.27 },
614 | { "time": 0.4, "angle": 15.27 },
615 | { "time": 0.6, "angle": -24.69 },
616 | { "time": 0.7666, "angle": -11.02 },
617 | { "time": 0.9333, "angle": -24.38 },
618 | { "time": 1.0666, "angle": 11.99 },
619 | { "time": 1.3, "angle": 4.86 },
620 | { "time": 1.3666, "angle": 5.19 }
621 | ],
622 | "translate": [
623 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
624 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
625 | { "time": 1.3666, "x": 0, "y": 0 }
626 | ],
627 | "scale": [
628 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
629 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
630 | { "time": 1.3666, "x": 1, "y": 1 }
631 | ]
632 | },
633 | "left shoulder": {
634 | "rotate": [
635 | {
636 | "time": 0,
637 | "angle": 0.05,
638 | "curve": [ 0, 0, 0.62, 1 ]
639 | },
640 | {
641 | "time": 0.2333,
642 | "angle": 279.66,
643 | "curve": [ 0.218, 0.67, 0.66, 0.99 ]
644 | },
645 | {
646 | "time": 0.5,
647 | "angle": 62.27,
648 | "curve": [ 0.462, 0, 0.764, 0.58 ]
649 | },
650 | { "time": 0.9333, "angle": 28.91 },
651 | { "time": 1.0666, "angle": -8.62 },
652 | { "time": 1.1666, "angle": -18.43 },
653 | { "time": 1.3666, "angle": 0.05 }
654 | ],
655 | "translate": [
656 | { "time": 0, "x": -1.76, "y": 0.56, "curve": "stepped" },
657 | { "time": 0.9333, "x": -1.76, "y": 0.56, "curve": "stepped" },
658 | { "time": 1.3666, "x": -1.76, "y": 0.56 }
659 | ],
660 | "scale": [
661 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
662 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
663 | { "time": 1.3666, "x": 1, "y": 1 }
664 | ]
665 | },
666 | "left hand": {
667 | "rotate": [
668 | { "time": 0, "angle": 11.58, "curve": "stepped" },
669 | { "time": 0.9333, "angle": 11.58, "curve": "stepped" },
670 | { "time": 1.3666, "angle": 11.58 }
671 | ],
672 | "translate": [
673 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
674 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
675 | { "time": 1.3666, "x": 0, "y": 0 }
676 | ],
677 | "scale": [
678 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
679 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
680 | { "time": 1.3666, "x": 1, "y": 1 }
681 | ]
682 | },
683 | "left arm": {
684 | "rotate": [
685 | { "time": 0, "angle": 0.51 },
686 | { "time": 0.4333, "angle": 12.82 },
687 | { "time": 0.6, "angle": 47.55 },
688 | { "time": 0.9333, "angle": 12.82 },
689 | { "time": 1.1666, "angle": -6.5 },
690 | { "time": 1.3666, "angle": 0.51 }
691 | ],
692 | "translate": [
693 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
694 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
695 | { "time": 1.3666, "x": 0, "y": 0 }
696 | ],
697 | "scale": [
698 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
699 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
700 | { "time": 1.3666, "x": 1, "y": 1 }
701 | ]
702 | },
703 | "right shoulder": {
704 | "rotate": [
705 | {
706 | "time": 0,
707 | "angle": 43.82,
708 | "curve": [ 0, 0, 0.62, 1 ]
709 | },
710 | {
711 | "time": 0.2333,
712 | "angle": -8.74,
713 | "curve": [ 0.304, 0.58, 0.709, 0.97 ]
714 | },
715 | {
716 | "time": 0.5333,
717 | "angle": -208.02,
718 | "curve": [ 0.462, 0, 0.764, 0.58 ]
719 | },
720 | { "time": 0.9333, "angle": -246.72 },
721 | { "time": 1.0666, "angle": -307.13 },
722 | { "time": 1.1666, "angle": 37.15 },
723 | { "time": 1.3666, "angle": 43.82 }
724 | ],
725 | "translate": [
726 | { "time": 0, "x": -7.84, "y": 7.19, "curve": "stepped" },
727 | { "time": 0.9333, "x": -7.84, "y": 7.19, "curve": "stepped" },
728 | { "time": 1.3666, "x": -7.84, "y": 7.19 }
729 | ],
730 | "scale": [
731 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
732 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
733 | { "time": 1.3666, "x": 1, "y": 1 }
734 | ]
735 | },
736 | "right arm": {
737 | "rotate": [
738 | { "time": 0, "angle": -4.02 },
739 | { "time": 0.6, "angle": 17.5 },
740 | { "time": 0.9333, "angle": -4.02 },
741 | { "time": 1.1666, "angle": -16.72 },
742 | { "time": 1.3666, "angle": -4.02 }
743 | ],
744 | "translate": [
745 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
746 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
747 | { "time": 1.3666, "x": 0, "y": 0 }
748 | ],
749 | "scale": [
750 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
751 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
752 | { "time": 1.3666, "x": 1, "y": 1 }
753 | ]
754 | },
755 | "right hand": {
756 | "rotate": [
757 | { "time": 0, "angle": 22.92, "curve": "stepped" },
758 | { "time": 0.9333, "angle": 22.92, "curve": "stepped" },
759 | { "time": 1.3666, "angle": 22.92 }
760 | ],
761 | "translate": [
762 | { "time": 0, "x": 0, "y": 0, "curve": "stepped" },
763 | { "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
764 | { "time": 1.3666, "x": 0, "y": 0 }
765 | ],
766 | "scale": [
767 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
768 | { "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
769 | { "time": 1.3666, "x": 1, "y": 1 }
770 | ]
771 | },
772 | "root": {
773 | "rotate": [
774 | { "time": 0, "angle": 0 },
775 | { "time": 0.4333, "angle": -14.52 },
776 | { "time": 0.8, "angle": 9.86 },
777 | { "time": 1.3666, "angle": 0 }
778 | ],
779 | "scale": [
780 | { "time": 0, "x": 1, "y": 1, "curve": "stepped" },
781 | { "time": 1.3666, "x": 1, "y": 1 }
782 | ]
783 | }
784 | }
785 | }
786 | }
787 | }
788 |
--------------------------------------------------------------------------------