@galacean/engine-spine 4.2.0 → 4.2.1
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/README.md +64 -42
- package/dist/browser.js +1 -1
- package/dist/main.js +635 -1056
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +635 -1056
- package/dist/module.js +634 -1056
- package/dist/module.js.map +1 -1
- package/package.json +50 -38
- package/types/index.d.ts +2 -5
- package/types/loader/LoaderUtils.d.ts +11 -17
- package/types/loader/SpineAtlasLoader.d.ts +7 -0
- package/types/loader/SpineLoader.d.ts +11 -25
- package/types/loader/SpineResource.d.ts +33 -0
- package/types/loader/SpineTexture.d.ts +13 -0
- package/types/loader/index.d.ts +4 -0
- package/types/{SpineAnimationRenderer.d.ts → renderer/SpineAnimationRenderer.d.ts} +45 -81
- package/types/{SpineGenerator.d.ts → renderer/SpineGenerator.d.ts} +12 -15
- package/types/renderer/index.d.ts +2 -0
- package/types/util/BlendMode.d.ts +1 -1
- package/types/loader/EditorSpineAtlasLoader.d.ts +0 -6
- package/types/loader/SkeletonDataResource.d.ts +0 -12
- package/types/tsconfig.tsbuildinfo +0 -1
- package/types/util/BufferReader.d.ts +0 -10
- /package/types/{SpineMaterial.d.ts → renderer/SpineMaterial.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
# Galacean Engine
|
|
4
|
-

|
|
3
|
+
# Galacean Engine Spine Runtime
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|

|
|
@@ -10,72 +9,95 @@
|
|
|
10
9
|
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
[@galacean/engine-spine](https://www.npmjs.com/package/@galacean/engine-spine) is the Spine runtime module for the [Galacean engine](https://github.com/galacean/engine), providing efficient support for Spine animations. This package enables developers to seamlessly integrate and use Spine animations, delivering smooth skeletal animation effects optimized for both web and mobile platforms.
|
|
13
13
|
|
|
14
|
+
##
|
|
15
|
+
## Installation
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
## Usage
|
|
17
|
+
Install **@galacean/engine-spine** via npm:
|
|
18
18
|
|
|
19
|
+
```bash
|
|
20
|
+
npm install @galacean/engine-spine
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Here's a simple example to get started with **@galacean/engine-spine**:
|
|
19
27
|
|
|
20
28
|
```typescript
|
|
21
29
|
import { SpineAnimationRenderer } from '@galacean/engine-spine';
|
|
22
30
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
async function addSpine() {
|
|
27
|
-
const resource = await engine.resourceManager.load(
|
|
28
|
-
{
|
|
29
|
-
url: 'https://mdn.alipayobjects.com/huamei_kz4wfo/uri/file/as/2/kz4wfo/4/mp/yKbdfgijyLGzQDyQ/spineboy/spineboy.json',
|
|
30
|
-
type: 'spine',
|
|
31
|
-
},
|
|
32
|
-
);
|
|
33
|
-
const spineEntity = new Entity(engine);
|
|
34
|
-
const spine = entity.addComponent(SpineAnimationRenderer);
|
|
35
|
-
spine.resource = resource;
|
|
36
|
-
spine.defaultState.animationName = 'walk';
|
|
37
|
-
rootEntity.addChild(spineEntity);
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
31
|
+
// First setup for galacean engine, get scene and create root entity.
|
|
32
|
+
// Find setup code here:
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
// And then load spine resource and instantiate a spine entity with the resource.
|
|
35
|
+
const spineResource = await engine.resourceManager.load({
|
|
36
|
+
url: 'https://mdn.alipayobjects.com/huamei_kz4wfo/uri/file/as/2/kz4wfo/4/mp/yKbdfgijyLGzQDyQ/spineboy/spineboy.json',
|
|
37
|
+
type: 'spine',
|
|
38
|
+
});
|
|
39
|
+
const spineEntity = spineResource.instantiate();
|
|
40
|
+
rootEntity.addChild(spineEntity);
|
|
45
41
|
```
|
|
46
42
|
|
|
43
|
+
## API Documentation
|
|
47
44
|
|
|
45
|
+
For a detailed overview of the API, including all classes, methods, and properties, please refer to the [Full API Documentation](https://galacean.antgroup.com/engine/en/docs/graphics/2D/spine/api/).
|
|
48
46
|
|
|
49
47
|
|
|
50
|
-
## Version
|
|
51
|
-
@galacean/engine-spine currently only supports spine version 3.8
|
|
48
|
+
## Version Compatibility
|
|
52
49
|
|
|
50
|
+
### Package and Spine Version Compatibility
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
| Package Version | Spine Version |
|
|
53
|
+
|-----------------|-----------------------|
|
|
54
|
+
| Below 4.0 | Spine 3.8 |
|
|
55
|
+
| 4.0 | Spine 4.0 |
|
|
56
|
+
| 4.1 | Spine 4.1 |
|
|
57
|
+
| 4.2 | Spine 4.2 |
|
|
58
|
+
| 4.x (e.g., 4.0, 4.1) | Corresponds to Spine x.x |
|
|
59
|
+
| 4.x.y (minor version `y`) | Independent from Spine |
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
- High performance.
|
|
58
|
-
- Intergrated with galacean engine.
|
|
59
|
-
- Component based API.
|
|
61
|
+
> Note: Ensure that the package version aligns with the corresponding Spine editor version for compatibility.
|
|
60
62
|
|
|
63
|
+
### Package and Galacean Engine Version Compatibility
|
|
61
64
|
|
|
65
|
+
| Package Version | Galacean Engine Version |
|
|
66
|
+
|-----------------|-------------------------|
|
|
67
|
+
| 4.0 and above | 1.3 and above |
|
|
68
|
+
| Below 4.0 (e.g., 1.2.0) | 1.2 |
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
Everyone is welcome to join us! Whether you find a bug, have a great feature request or you fancy owning a task from the road map feel free to get in touch.
|
|
65
|
-
|
|
70
|
+
> Note: Please verify that the versions of both the package and the Galacean Engine are compatible, as mismatched versions may cause unexpected issues.
|
|
66
71
|
|
|
67
|
-
Make sure to read the [Contributing Guide](.github/HOW_TO_CONTRIBUTE.md) before submitting changes.
|
|
68
72
|
|
|
73
|
+
## Building and Development
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
To set up the project for development and build it for production, follow these steps:
|
|
71
76
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
1. **Install dependencies**:
|
|
78
|
+
```bash
|
|
79
|
+
npm install
|
|
80
|
+
```
|
|
81
|
+
2. **Start development environment**:
|
|
82
|
+
```bash
|
|
83
|
+
npm run dev
|
|
84
|
+
```
|
|
85
|
+
3. **Build for production**:
|
|
86
|
+
```bash
|
|
87
|
+
npm run build
|
|
88
|
+
```
|
|
89
|
+
4. **Run examples**:
|
|
90
|
+
```bash
|
|
91
|
+
npm run example
|
|
92
|
+
```
|
|
75
93
|
|
|
76
94
|
|
|
77
95
|
|
|
78
|
-
##
|
|
96
|
+
## Links
|
|
97
|
+
- [Examples](https://galacean.antgroup.com/engine/en/docs/graphics/2D/spine/example/) - View usage examples for common scenarios.
|
|
98
|
+
- [User Guide](https://galacean.antgroup.com/engine/en/docs/graphics/2D/spine/overview/) - Comprehensive guide for using this package within the Galacean editor and in scripts.
|
|
99
|
+
- [API Reference](https://galacean.antgroup.com/engine/en/docs/graphics/2D/spine/api/) - Complete API documentation for all available classes, methods, and properties.
|
|
79
100
|
|
|
80
101
|
|
|
102
|
+
## License
|
|
81
103
|
The Galacean Engine is released under the [MIT](https://opensource.org/licenses/MIT) license. See LICENSE file.
|