Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Feat: add spine doc #810

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/editor-spine.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
order: 6
title: Spine 渲染组件
type: 功能
group: 2D 渲染
label: Editor-Feature/Rendering-2d
---

[Spine](https://airbnb.design/lottie/) 是一款针对游戏开发的 2D 骨骼动画编辑工具。 Spine 旨在提供更高效和简洁 的工作流程,以创建游戏所需的动画。在 Galacean Editor中,用户能够轻松完成 Spine 资产的处理和组件添加~


## 基础使用

首先,需要设计师在 spine 编辑器中[导出](http://zh.esotericsoftware.com/spine-export#JSON) spine 素材。素材包含 json,atlas,png 三个文件。

开发者需要同时把三个文件上传到 Galacean Editor。通过资产面板的上传按钮选择 “spine” 资产,选择本地的这三个文件,上传成功后能够在资产面板看到上传的 spine 资产:

<img src="https://mdn.alipayobjects.com/huamei_kz4wfo/afts/img/A*yTReSbOtsQIAAAAAAAAAAAAADsp6AQ/original" style="zoom:50%;" />

选择一个节点,添加 Spine 组件,选择 resource 为上一步上传的资产,填写动画名称即播放 spine 动画:

![spine](https://mdn.alipayobjects.com/huamei_kz4wfo/afts/img/A*gE3qSqzp0S4AAAAAAAAAAAAADsp6AQ/original)

### 参数说明

| 属性 | 功能说明 |
| :--- | :--- |
| `resource` | 选择 Spine 资产 |
| `autoPlay` | 是否自动播放 |
| `animation` | 动画名称 |
| `Scale` | 动画缩放 |
2 changes: 1 addition & 1 deletion docs/spine.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Galacean Spine 运行时需要使用 .json(或者.bin), atlas, png 这几种
文件导出的详细配置见 spine 官方文档:[http://zh.esotericsoftware.com/spine-export](http://zh.esotericsoftware.com/spine-export/)

### 资源加载
当引入了 _@galacean/engine-spine_ 后,会自动在 [engine]($%7Bapi%7Dcore/Engine) 的 [resourceManager]($%7Bapi%7Dcore/Engine#resourceManager) 上注册 spine 资源的资源加载器。通过 resourceManager 的 [load]($%7Bapi%7Dcore/ResourceManager/#load) 方法能够加载 spine 动画资源。
如果你在编辑器中使用,请参考[文档](${docs}editor-spine)。如果在纯代码项目中,当引入了 _@galacean/engine-spine_ 后,会自动在 [engine]($%7Bapi%7Dcore/Engine) 的 [resourceManager]($%7Bapi%7Dcore/Engine#resourceManager) 上注册 spine 资源的资源加载器。通过 resourceManager 的 [load]($%7Bapi%7Dcore/ResourceManager/#load) 方法能够加载 spine 动画资源。

- 当传递参数为 url 时,默认 spine 动画的资源拥有同样的 baseUrl,仅需传递 json(或者 bin) 文件的 cdn 即可。
- 当传递参数为 urls 数组时,需要传递 json(或者 bin),atlas, image(png,jpg)三个资源的 cdn 地址。
Expand Down