@galacean/effects-plugin-spine 0.0.0-experimental-downgrade624-20240904

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # Galacean Effects Spine Plugin
2
+
3
+ ## Usage
4
+
5
+ ### Simple Import
6
+
7
+ ``` ts
8
+ import { Player } from '@galacean/effects';
9
+ import '@galacean/effects-plugin-spine';
10
+ ```
11
+
12
+ ### Get Spine Resource List
13
+
14
+ ``` ts
15
+ import type { SpineResource } from '@galacean/effects-plugin-spine';
16
+
17
+ const comp = await player.play(scene);
18
+ const spineData: SpineResource[] = comp.loaderData.spineDatas;
19
+ ```
20
+
21
+ ### Get Animation List / Skin List
22
+
23
+ 1. Get using functions
24
+
25
+ ``` ts
26
+ const comp = await new Player().loadScene(scene);
27
+ const item = comp.getItemByName(name)
28
+ const { skeletonData } = item.spineDataCache;
29
+ const animationList = getAnimationList(skeletonData);
30
+ const skinList = getSkinList(skeletonData);
31
+ ```
32
+
33
+ 2. Get from the `spineDatas` array
34
+
35
+ ``` ts
36
+ const comp = await new Player().loadScene(scene);
37
+ const { skinList, animationList } = comp.loaderData.spineDatas[index];
38
+ ```
39
+
40
+ ### Get Duration of a Specific Animation
41
+
42
+ ``` ts
43
+ const animationDuration = getAnimationDuration(skeletonData, animationName);
44
+ ```
45
+
46
+ ### Get Texture Creation Options
47
+ ``` ts
48
+ import { getTextureOptions } from '@galacean/effects-plugin-spine';
49
+
50
+ const { magFilter, minFilter, wrapS, wrapT, pma } = getTextureOptions(atlasBuffer);
51
+ ```
52
+
53
+ ### Set Animation Mix Duration
54
+
55
+ 1. Set default mix duration for an animation (should be called before `player.play`)
56
+
57
+ ``` ts
58
+ const comp = await new Player().loadScene(scene);
59
+ const item = comp.getItemByName(name);
60
+
61
+ item.setDefaultMixDuration(mix);
62
+ ```
63
+
64
+ 2. Set mix duration for a specific transition (should be called before `player.play`)
65
+
66
+ ``` ts
67
+ const comp = await new Player().loadScene(scene);
68
+ const item = comp.getItemByName(name);
69
+
70
+ item.setMixDuration(animationOut, animationIn, mix);
71
+ ```
72
+
73
+ ### Set Playback Speed
74
+
75
+ ``` ts
76
+ const comp = await new Player().loadScene(scene);
77
+ const item = comp.getItemByName(name);
78
+
79
+ item.setSpeed(speed);
80
+ ```
81
+
82
+ ### Set Animation
83
+
84
+ 1. Set a single animation
85
+
86
+ ``` ts
87
+ const comp = await new Player().loadScene(scene);
88
+ const item = comp.getItemByName(name);
89
+
90
+ item.setAnimation(animationName, speed);
91
+ ```
92
+
93
+ 2. Set a group of animations
94
+
95
+ ``` ts
96
+ const comp = await new Player().loadScene(scene);
97
+ const item = comp.getItemByName(name);
98
+ const animationList = [animationName1, animationName2, animationName3];
99
+
100
+ item.setAnimation(animationList, speed);
101
+ ```
102
+
103
+ ## Development
104
+
105
+ ### Getting Started
106
+
107
+ ``` bash
108
+ # demo
109
+ pnpm --filter @galacean/effects-plugin-spine dev
110
+ ```
111
+
112
+ > Open in browser: http://localhost:8081/demo/
113
+
114
+ ## Frame Comparison Testing
115
+
116
+ > Open in browser: http://localhost:8081/test/