mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[phaser] coordine system transforms and example.
This commit is contained in:
parent
f725a80994
commit
97765425ec
@ -354,6 +354,16 @@ cp -f ../coin/export/coin-pro.skel "$ROOT/spine-ts/spine-phaser/example/assets/"
|
|||||||
cp -f ../coin/export/coin-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
cp -f ../coin/export/coin-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
cp -f ../coin/export/coin-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
cp -f ../coin/export/coin-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
|
||||||
|
cp -f ../stretchyman/export/stretchyman-pro.json "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../stretchyman/export/stretchyman-pro.skel "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../stretchyman/export/stretchyman-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../stretchyman/export/stretchyman-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
|
||||||
|
cp -f ../mix-and-match/export/mix-and-match-pro.json "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../mix-and-match/export/mix-and-match-pro.skel "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../mix-and-match/export/mix-and-match-pma.atlas "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
cp -f ../mix-and-match/export/mix-and-match-pma.png "$ROOT/spine-ts/spine-phaser/example/assets/"
|
||||||
|
|
||||||
echo "spine-monogame"
|
echo "spine-monogame"
|
||||||
rm "$ROOT/spine-monogame/spine-monogame-example/data/"*
|
rm "$ROOT/spine-monogame/spine-monogame-example/data/"*
|
||||||
cp -f ../coin/export/coin-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/"
|
cp -f ../coin/export/coin-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/"
|
||||||
|
|||||||
363
spine-ts/spine-phaser/example/assets/mix-and-match-pma.atlas
Normal file
363
spine-ts/spine-phaser/example/assets/mix-and-match-pma.atlas
Normal file
@ -0,0 +1,363 @@
|
|||||||
|
mix-and-match-pma.png
|
||||||
|
size: 1024, 512
|
||||||
|
filter: Linear, Linear
|
||||||
|
pma: true
|
||||||
|
scale: 0.5
|
||||||
|
base-head
|
||||||
|
bounds: 587, 2, 95, 73
|
||||||
|
boy/arm-front
|
||||||
|
bounds: 558, 271, 36, 115
|
||||||
|
boy/backpack
|
||||||
|
bounds: 235, 109, 119, 153
|
||||||
|
boy/backpack-pocket
|
||||||
|
bounds: 328, 73, 34, 62
|
||||||
|
rotate: 90
|
||||||
|
boy/backpack-strap-front
|
||||||
|
bounds: 665, 79, 38, 88
|
||||||
|
boy/backpack-up
|
||||||
|
bounds: 395, 364, 21, 70
|
||||||
|
rotate: 90
|
||||||
|
boy/body
|
||||||
|
bounds: 251, 264, 97, 132
|
||||||
|
rotate: 90
|
||||||
|
boy/boot-ribbon-front
|
||||||
|
bounds: 648, 131, 9, 11
|
||||||
|
boy/collar
|
||||||
|
bounds: 744, 4, 73, 29
|
||||||
|
rotate: 90
|
||||||
|
boy/ear
|
||||||
|
bounds: 383, 109, 19, 23
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-back-low-eyelid
|
||||||
|
bounds: 739, 284, 17, 6
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-back-pupil
|
||||||
|
bounds: 832, 443, 8, 9
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-back-up-eyelid
|
||||||
|
bounds: 558, 264, 23, 5
|
||||||
|
boy/eye-back-up-eyelid-back
|
||||||
|
bounds: 802, 491, 19, 10
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-front-low-eyelid
|
||||||
|
bounds: 386, 363, 22, 7
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-front-pupil
|
||||||
|
bounds: 816, 389, 9, 9
|
||||||
|
boy/eye-front-up-eyelid
|
||||||
|
bounds: 160, 71, 31, 6
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-front-up-eyelid-back
|
||||||
|
bounds: 801, 434, 26, 9
|
||||||
|
rotate: 90
|
||||||
|
boy/eye-iris-back
|
||||||
|
bounds: 618, 264, 17, 17
|
||||||
|
boy/eye-iris-front
|
||||||
|
bounds: 727, 264, 18, 18
|
||||||
|
boy/eye-white-back
|
||||||
|
bounds: 580, 131, 20, 12
|
||||||
|
boy/eye-white-front
|
||||||
|
bounds: 510, 130, 27, 13
|
||||||
|
boy/eyebrow-back
|
||||||
|
bounds: 751, 88, 20, 11
|
||||||
|
rotate: 90
|
||||||
|
boy/eyebrow-front
|
||||||
|
bounds: 483, 130, 25, 11
|
||||||
|
boy/hair-back
|
||||||
|
bounds: 494, 388, 122, 81
|
||||||
|
rotate: 90
|
||||||
|
boy/hair-bangs
|
||||||
|
bounds: 667, 284, 70, 37
|
||||||
|
boy/hair-side
|
||||||
|
bounds: 789, 374, 25, 43
|
||||||
|
boy/hand-backfingers
|
||||||
|
bounds: 467, 364, 19, 21
|
||||||
|
boy/hand-front-fingers
|
||||||
|
bounds: 488, 364, 19, 21
|
||||||
|
boy/hat
|
||||||
|
bounds: 615, 417, 93, 56
|
||||||
|
rotate: 90
|
||||||
|
boy/leg-front
|
||||||
|
bounds: 138, 104, 31, 158
|
||||||
|
boy/mouth-close
|
||||||
|
bounds: 551, 365, 21, 5
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/mouth-close
|
||||||
|
bounds: 551, 365, 21, 5
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/mouth-close
|
||||||
|
bounds: 551, 365, 21, 5
|
||||||
|
rotate: 90
|
||||||
|
girl/mouth-close
|
||||||
|
bounds: 551, 365, 21, 5
|
||||||
|
rotate: 90
|
||||||
|
boy/mouth-smile
|
||||||
|
bounds: 705, 79, 29, 7
|
||||||
|
boy/nose
|
||||||
|
bounds: 836, 473, 17, 10
|
||||||
|
rotate: 90
|
||||||
|
boy/pompom
|
||||||
|
bounds: 747, 273, 48, 43
|
||||||
|
rotate: 90
|
||||||
|
boy/zip
|
||||||
|
bounds: 648, 144, 14, 23
|
||||||
|
girl-blue-cape/back-eyebrow
|
||||||
|
bounds: 602, 131, 18, 12
|
||||||
|
girl-blue-cape/body-dress
|
||||||
|
bounds: 2, 264, 109, 246
|
||||||
|
girl-blue-cape/body-ribbon
|
||||||
|
bounds: 615, 283, 50, 38
|
||||||
|
girl-blue-cape/cape-back
|
||||||
|
bounds: 2, 69, 134, 193
|
||||||
|
girl-blue-cape/cape-back-up
|
||||||
|
bounds: 386, 387, 123, 106
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/cape-ribbon
|
||||||
|
bounds: 675, 264, 50, 18
|
||||||
|
girl-blue-cape/cape-shoulder-back
|
||||||
|
bounds: 751, 110, 49, 59
|
||||||
|
girl-blue-cape/cape-shoulder-front
|
||||||
|
bounds: 113, 264, 62, 76
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/cape-up-front
|
||||||
|
bounds: 399, 264, 98, 117
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/ear
|
||||||
|
bounds: 775, 2, 19, 23
|
||||||
|
girl-spring-dress/ear
|
||||||
|
bounds: 775, 2, 19, 23
|
||||||
|
girl/ear
|
||||||
|
bounds: 775, 2, 19, 23
|
||||||
|
girl-blue-cape/eye-back-low-eyelid
|
||||||
|
bounds: 802, 463, 17, 6
|
||||||
|
girl-spring-dress/eye-back-low-eyelid
|
||||||
|
bounds: 802, 463, 17, 6
|
||||||
|
girl/eye-back-low-eyelid
|
||||||
|
bounds: 802, 463, 17, 6
|
||||||
|
girl-blue-cape/eye-back-pupil
|
||||||
|
bounds: 816, 367, 8, 9
|
||||||
|
girl-spring-dress/eye-back-pupil
|
||||||
|
bounds: 816, 367, 8, 9
|
||||||
|
girl/eye-back-pupil
|
||||||
|
bounds: 816, 367, 8, 9
|
||||||
|
girl-blue-cape/eye-back-up-eyelid
|
||||||
|
bounds: 554, 131, 24, 12
|
||||||
|
girl-spring-dress/eye-back-up-eyelid
|
||||||
|
bounds: 554, 131, 24, 12
|
||||||
|
girl/eye-back-up-eyelid
|
||||||
|
bounds: 554, 131, 24, 12
|
||||||
|
girl-blue-cape/eye-back-up-eyelid-back
|
||||||
|
bounds: 832, 453, 17, 11
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/eye-back-up-eyelid-back
|
||||||
|
bounds: 832, 453, 17, 11
|
||||||
|
rotate: 90
|
||||||
|
girl/eye-back-up-eyelid-back
|
||||||
|
bounds: 832, 453, 17, 11
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/eye-front-low-eyelid
|
||||||
|
bounds: 739, 303, 18, 6
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/eye-front-low-eyelid
|
||||||
|
bounds: 739, 303, 18, 6
|
||||||
|
rotate: 90
|
||||||
|
girl/eye-front-low-eyelid
|
||||||
|
bounds: 739, 303, 18, 6
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/eye-front-pupil
|
||||||
|
bounds: 816, 378, 9, 9
|
||||||
|
girl-spring-dress/eye-front-pupil
|
||||||
|
bounds: 816, 378, 9, 9
|
||||||
|
girl/eye-front-pupil
|
||||||
|
bounds: 816, 378, 9, 9
|
||||||
|
girl-blue-cape/eye-front-up-eyelid
|
||||||
|
bounds: 392, 77, 30, 14
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/eye-front-up-eyelid
|
||||||
|
bounds: 392, 77, 30, 14
|
||||||
|
rotate: 90
|
||||||
|
girl/eye-front-up-eyelid
|
||||||
|
bounds: 392, 77, 30, 14
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/eye-front-up-eyelid-back
|
||||||
|
bounds: 455, 130, 26, 11
|
||||||
|
girl-spring-dress/eye-front-up-eyelid-back
|
||||||
|
bounds: 455, 130, 26, 11
|
||||||
|
girl/eye-front-up-eyelid-back
|
||||||
|
bounds: 455, 130, 26, 11
|
||||||
|
girl-blue-cape/eye-iris-back
|
||||||
|
bounds: 637, 264, 17, 17
|
||||||
|
girl-blue-cape/eye-iris-front
|
||||||
|
bounds: 802, 471, 18, 18
|
||||||
|
girl-blue-cape/eye-white-back
|
||||||
|
bounds: 596, 264, 20, 16
|
||||||
|
girl-spring-dress/eye-white-back
|
||||||
|
bounds: 596, 264, 20, 16
|
||||||
|
girl-blue-cape/eye-white-front
|
||||||
|
bounds: 796, 5, 20, 16
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/eye-white-front
|
||||||
|
bounds: 796, 5, 20, 16
|
||||||
|
rotate: 90
|
||||||
|
girl/eye-white-front
|
||||||
|
bounds: 796, 5, 20, 16
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/front-eyebrow
|
||||||
|
bounds: 608, 149, 18, 12
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/hair-back
|
||||||
|
bounds: 508, 145, 117, 98
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/hair-bangs
|
||||||
|
bounds: 673, 419, 91, 40
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/hair-head-side-back
|
||||||
|
bounds: 196, 331, 30, 52
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/hair-head-side-front
|
||||||
|
bounds: 738, 323, 41, 42
|
||||||
|
girl-blue-cape/hair-side
|
||||||
|
bounds: 473, 3, 36, 71
|
||||||
|
girl-blue-cape/hand-front-fingers
|
||||||
|
bounds: 509, 365, 19, 21
|
||||||
|
girl-spring-dress/hand-front-fingers
|
||||||
|
bounds: 509, 365, 19, 21
|
||||||
|
girl-blue-cape/leg-front
|
||||||
|
bounds: 168, 72, 30, 158
|
||||||
|
rotate: 90
|
||||||
|
girl-blue-cape/mouth-smile
|
||||||
|
bounds: 736, 79, 29, 7
|
||||||
|
girl-spring-dress/mouth-smile
|
||||||
|
bounds: 736, 79, 29, 7
|
||||||
|
girl/mouth-smile
|
||||||
|
bounds: 736, 79, 29, 7
|
||||||
|
girl-blue-cape/nose
|
||||||
|
bounds: 747, 264, 11, 7
|
||||||
|
girl-spring-dress/nose
|
||||||
|
bounds: 747, 264, 11, 7
|
||||||
|
girl/nose
|
||||||
|
bounds: 747, 264, 11, 7
|
||||||
|
girl-blue-cape/sleeve-back
|
||||||
|
bounds: 767, 79, 42, 29
|
||||||
|
girl-blue-cape/sleeve-front
|
||||||
|
bounds: 408, 76, 52, 119
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/arm-front
|
||||||
|
bounds: 596, 282, 17, 111
|
||||||
|
girl-spring-dress/back-eyebrow
|
||||||
|
bounds: 801, 420, 18, 12
|
||||||
|
girl-spring-dress/body-up
|
||||||
|
bounds: 179, 4, 64, 66
|
||||||
|
girl-spring-dress/cloak-down
|
||||||
|
bounds: 775, 27, 50, 50
|
||||||
|
girl-spring-dress/cloak-up
|
||||||
|
bounds: 360, 7, 64, 58
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/eye-iris-back
|
||||||
|
bounds: 656, 264, 17, 17
|
||||||
|
girl-spring-dress/eye-iris-front
|
||||||
|
bounds: 814, 492, 18, 18
|
||||||
|
girl-spring-dress/front-eyebrow
|
||||||
|
bounds: 822, 472, 18, 12
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/hair-back
|
||||||
|
bounds: 196, 363, 147, 93
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/hair-bangs
|
||||||
|
bounds: 696, 326, 91, 40
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/hair-head-side-back
|
||||||
|
bounds: 529, 76, 30, 52
|
||||||
|
girl-spring-dress/hair-head-side-front
|
||||||
|
bounds: 781, 323, 41, 42
|
||||||
|
girl-spring-dress/hair-side
|
||||||
|
bounds: 511, 3, 36, 71
|
||||||
|
girl-spring-dress/leg-front
|
||||||
|
bounds: 171, 104, 30, 158
|
||||||
|
girl-spring-dress/neck
|
||||||
|
bounds: 138, 70, 20, 32
|
||||||
|
girl-spring-dress/shoulder-ribbon
|
||||||
|
bounds: 622, 131, 36, 24
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/skirt
|
||||||
|
bounds: 113, 328, 182, 81
|
||||||
|
rotate: 90
|
||||||
|
girl-spring-dress/underskirt
|
||||||
|
bounds: 2, 2, 175, 65
|
||||||
|
girl/arm-front
|
||||||
|
bounds: 577, 395, 36, 115
|
||||||
|
girl/back-eyebrow
|
||||||
|
bounds: 834, 492, 18, 12
|
||||||
|
rotate: 90
|
||||||
|
girl/bag-base
|
||||||
|
bounds: 191, 264, 62, 58
|
||||||
|
rotate: 90
|
||||||
|
girl/bag-strap-front
|
||||||
|
bounds: 385, 265, 12, 96
|
||||||
|
girl/bag-top
|
||||||
|
bounds: 738, 367, 49, 50
|
||||||
|
girl/body
|
||||||
|
bounds: 356, 130, 97, 132
|
||||||
|
girl/boot-ribbon-front
|
||||||
|
bounds: 539, 130, 13, 13
|
||||||
|
girl/eye-iris-back
|
||||||
|
bounds: 821, 424, 17, 17
|
||||||
|
girl/eye-iris-front
|
||||||
|
bounds: 812, 443, 18, 18
|
||||||
|
girl/eye-white-back
|
||||||
|
bounds: 814, 5, 20, 16
|
||||||
|
rotate: 90
|
||||||
|
girl/front-eyebrow
|
||||||
|
bounds: 816, 400, 18, 12
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-back
|
||||||
|
bounds: 291, 363, 147, 93
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-bangs
|
||||||
|
bounds: 715, 419, 91, 40
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-flap-down-front
|
||||||
|
bounds: 288, 5, 70, 65
|
||||||
|
girl/hair-head-side-back
|
||||||
|
bounds: 561, 77, 30, 52
|
||||||
|
girl/hair-head-side-front
|
||||||
|
bounds: 757, 419, 41, 42
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-patch
|
||||||
|
bounds: 245, 4, 66, 41
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-side
|
||||||
|
bounds: 549, 3, 36, 71
|
||||||
|
girl/hair-strand-back-1
|
||||||
|
bounds: 684, 3, 58, 74
|
||||||
|
girl/hair-strand-back-2
|
||||||
|
bounds: 692, 171, 91, 58
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-strand-back-3
|
||||||
|
bounds: 615, 323, 92, 79
|
||||||
|
rotate: 90
|
||||||
|
girl/hair-strand-front-1
|
||||||
|
bounds: 518, 269, 38, 94
|
||||||
|
girl/hair-strand-front-2
|
||||||
|
bounds: 593, 79, 70, 50
|
||||||
|
girl/hair-strand-front-3
|
||||||
|
bounds: 705, 88, 44, 81
|
||||||
|
girl/hand-front-fingers
|
||||||
|
bounds: 530, 365, 19, 21
|
||||||
|
girl/hat
|
||||||
|
bounds: 608, 169, 93, 82
|
||||||
|
rotate: 90
|
||||||
|
girl/leg-front
|
||||||
|
bounds: 203, 104, 30, 158
|
||||||
|
girl/pompom
|
||||||
|
bounds: 757, 462, 48, 43
|
||||||
|
rotate: 90
|
||||||
|
girl/scarf
|
||||||
|
bounds: 455, 143, 119, 51
|
||||||
|
rotate: 90
|
||||||
|
girl/scarf-back
|
||||||
|
bounds: 420, 2, 72, 51
|
||||||
|
rotate: 90
|
||||||
|
girl/zip
|
||||||
|
bounds: 356, 109, 19, 25
|
||||||
|
rotate: 90
|
||||||
BIN
spine-ts/spine-phaser/example/assets/mix-and-match-pma.png
Normal file
BIN
spine-ts/spine-phaser/example/assets/mix-and-match-pma.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 369 KiB |
8001
spine-ts/spine-phaser/example/assets/mix-and-match-pro.json
Normal file
8001
spine-ts/spine-phaser/example/assets/mix-and-match-pro.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
spine-ts/spine-phaser/example/assets/mix-and-match-pro.skel
Normal file
BIN
spine-ts/spine-phaser/example/assets/mix-and-match-pro.skel
Normal file
Binary file not shown.
16
spine-ts/spine-phaser/example/assets/stretchyman-pma.atlas
Normal file
16
spine-ts/spine-phaser/example/assets/stretchyman-pma.atlas
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
stretchyman-pma.png
|
||||||
|
size: 1024, 256
|
||||||
|
filter: Linear, Linear
|
||||||
|
pma: true
|
||||||
|
back-arm
|
||||||
|
bounds: 149, 45, 72, 202
|
||||||
|
back-leg
|
||||||
|
bounds: 312, 4, 100, 318
|
||||||
|
rotate: 90
|
||||||
|
body
|
||||||
|
bounds: 223, 106, 141, 452
|
||||||
|
rotate: 90
|
||||||
|
front-arm
|
||||||
|
bounds: 2, 26, 145, 221
|
||||||
|
head
|
||||||
|
bounds: 223, 2, 87, 102
|
||||||
BIN
spine-ts/spine-phaser/example/assets/stretchyman-pma.png
Normal file
BIN
spine-ts/spine-phaser/example/assets/stretchyman-pma.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
2116
spine-ts/spine-phaser/example/assets/stretchyman-pro.json
Normal file
2116
spine-ts/spine-phaser/example/assets/stretchyman-pro.json
Normal file
File diff suppressed because one or more lines are too long
BIN
spine-ts/spine-phaser/example/assets/stretchyman-pro.skel
Normal file
BIN
spine-ts/spine-phaser/example/assets/stretchyman-pro.skel
Normal file
Binary file not shown.
71
spine-ts/spine-phaser/example/control-bones-test.html
Normal file
71
spine-ts/spine-phaser/example/control-bones-test.html
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
|
||||||
|
<script src="../dist/iife/spine-phaser.js"></script>
|
||||||
|
<title>Spine Phaser Example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Control bones</h1>
|
||||||
|
<script>
|
||||||
|
var config = {
|
||||||
|
type: Phaser.AUTO,
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
type: Phaser.WEBGL,
|
||||||
|
scene: {
|
||||||
|
preload: preload,
|
||||||
|
create: create,
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
scene: [
|
||||||
|
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let game = new Phaser.Game(config);
|
||||||
|
|
||||||
|
function preload () {
|
||||||
|
this.load.spineBinary("stretchyman-data", "assets/stretchyman-pro.skel");
|
||||||
|
this.load.spineAtlas("stretchyman-atlas", "assets/stretchyman-pma.atlas");
|
||||||
|
}
|
||||||
|
|
||||||
|
function create () {
|
||||||
|
let stretchyman = this.add.spine(400, 550, 'stretchyman-data', "stretchyman-atlas");
|
||||||
|
stretchyman.scale = 0.8;
|
||||||
|
stretchyman.skeleton.updateWorldTransform();
|
||||||
|
|
||||||
|
var controlBones = ["back-arm-ik-target", "back-leg-ik-target", "front-arm-ik-target", "front-leg-ik-target"];
|
||||||
|
for (var i = 0; i < controlBones.length; i++)
|
||||||
|
{
|
||||||
|
var bone = stretchyman.skeleton.findBone(controlBones[i]);
|
||||||
|
let point = {x: bone.worldX, y: bone.worldY};
|
||||||
|
stretchyman.skeletonToPhaserWorldCoordinates(point);
|
||||||
|
|
||||||
|
var control = this.add.circle(point.x, point.y, 4, 0xff00ff).setData('bone', bone);
|
||||||
|
|
||||||
|
control.setInteractive();
|
||||||
|
this.input.setDraggable(control);
|
||||||
|
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
|
||||||
|
|
||||||
|
gameObject.x = dragX;
|
||||||
|
gameObject.y = dragY;
|
||||||
|
|
||||||
|
var bone = gameObject.getData('bone');
|
||||||
|
let point = { x: dragX, y: dragY };
|
||||||
|
stretchyman.phaserWorldCoordinatesToBone(point, bone);
|
||||||
|
|
||||||
|
bone.x = point.x;
|
||||||
|
bone.y = point.y;
|
||||||
|
bone.update();
|
||||||
|
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -18,6 +18,7 @@
|
|||||||
<li><a href="./arcade-physics-test.html">Arcade physics example</a></li>
|
<li><a href="./arcade-physics-test.html">Arcade physics example</a></li>
|
||||||
<li><a href="./blend-test.html">Blend test</a></li>
|
<li><a href="./blend-test.html">Blend test</a></li>
|
||||||
<li><a href="./camera-pipeline-test.html">Camera pipeline test</a></li>
|
<li><a href="./camera-pipeline-test.html">Camera pipeline test</a></li>
|
||||||
|
<li><a href="./control-bones-test.html">Control bones</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import { SPINE_GAME_OBJECT_TYPE } from "./keys";
|
import { SPINE_GAME_OBJECT_TYPE } from "./keys";
|
||||||
import { SpinePlugin } from "./SpinePlugin";
|
import { SpinePlugin } from "./SpinePlugin";
|
||||||
import { ComputedSizeMixin, DepthMixin, FlipMixin, ScrollFactorMixin, TransformMixin, VisibleMixin } from "./mixins";
|
import { ComputedSizeMixin, DepthMixin, FlipMixin, ScrollFactorMixin, TransformMixin, VisibleMixin } from "./mixins";
|
||||||
import { AnimationState, AnimationStateData, MathUtils, Skeleton, Skin } from "@esotericsoftware/spine-core";
|
import { AnimationState, AnimationStateData, Bone, MathUtils, Skeleton, Skin, Vector2 } from "@esotericsoftware/spine-core";
|
||||||
|
import { Vector3 } from "@esotericsoftware/spine-webgl";
|
||||||
|
|
||||||
class BaseSpineGameObject extends Phaser.GameObjects.GameObject {
|
class BaseSpineGameObject extends Phaser.GameObjects.GameObject {
|
||||||
constructor(scene: Phaser.Scene, type: string) {
|
constructor(scene: Phaser.Scene, type: string) {
|
||||||
@ -151,6 +152,34 @@ export class SpineGameObject extends ComputedSizeMixin(DepthMixin(FlipMixin(Scro
|
|||||||
this.displayOriginY = -bounds.y;
|
this.displayOriginY = -bounds.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skeletonToPhaserWorldCoordinates(point: {x: number, y: number}) {
|
||||||
|
let transform = this.getWorldTransformMatrix();
|
||||||
|
let a = transform.a, b = transform.b, c = transform.c, d = transform.d, tx = transform.tx, ty = transform.ty;
|
||||||
|
let x = point.x
|
||||||
|
let y = point.y
|
||||||
|
point.x = x * a + y * c + tx;
|
||||||
|
point.y = x * b + y * d + ty;
|
||||||
|
}
|
||||||
|
|
||||||
|
phaserWorldCoordinatesToSkeleton(point: {x: number, y: number}) {
|
||||||
|
let transform = this.getWorldTransformMatrix();
|
||||||
|
transform = transform.invert();
|
||||||
|
let a = transform.a, b = transform.b, c = transform.c, d = transform.d, tx = transform.tx, ty = transform.ty;
|
||||||
|
let x = point.x
|
||||||
|
let y = point.y
|
||||||
|
point.x = x * a + y * c + tx;
|
||||||
|
point.y = x * b + y * d + ty;
|
||||||
|
}
|
||||||
|
|
||||||
|
phaserWorldCoordinatesToBone(point: {x: number, y: number}, bone: Bone) {
|
||||||
|
this.phaserWorldCoordinatesToSkeleton(point);
|
||||||
|
if (bone.parent) {
|
||||||
|
bone.parent.worldToLocal(point as Vector2);
|
||||||
|
} else {
|
||||||
|
bone.worldToLocal(point as Vector2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preUpdate(time: number, delta: number) {
|
preUpdate(time: number, delta: number) {
|
||||||
if (!this.skeleton || !this.animationState) return;
|
if (!this.skeleton || !this.animationState) return;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user