Skip to content

Commit

Permalink
feat: fix content
Browse files Browse the repository at this point in the history
  • Loading branch information
luzhuang committed Feb 12, 2025
1 parent 654ed94 commit 7b0cf5f
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 36 deletions.
5 changes: 5 additions & 0 deletions docs/en/animation/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"examples": {
"title": "Guides and Examples"
}
}
10 changes: 5 additions & 5 deletions docs/en/animation/animator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Before using scripts, it is recommended to read the following documents:

### Play Specified Animation State

You can use the [animator.play](/apis/core/#Animator-play) method to play the specified `Animation State`. For parameter descriptions, see the [API documentation](/apis/core/#Animator-play).
You can use the [animator.play](/apis/core/#Animator-play) method to play the specified `AnimatorState` . For parameter descriptions, see the [API documentation](/apis/core/#Animator-play).

```typescript
import { Script, Animator, Keys } from '@galacean/engine';
Expand Down Expand Up @@ -113,7 +113,7 @@ animator.speed = 0;
animator.speed = 1;
```

If you only want to pause a specific `Animation State`, you can do so by setting its speed to 0.
If you only want to pause a specific `AnimatorState` , you can do so by setting its speed to 0.

```typescript
const state = animator.findAnimatorState("xxx");
Expand All @@ -122,15 +122,15 @@ state.speed = 0;

### Transition to Specified Animation State

You can use the [animator.crossfade](/apis/core/#Animator-crossfade) method to transition to the specified `Animation State`. For parameter descriptions, see the [API documentation](/apis/core/#Animator-crossFade).
You can use the [animator.crossfade](/apis/core/#Animator-crossfade) method to transition to the specified `AnimatorState` . For parameter descriptions, see the [API documentation](/apis/core/#Animator-crossFade).

```typescript
animator.crossFade("OtherStateName", 0.3);
```

### Get Current Playing Animation State

You can use the [getCurrentAnimatorState](/apis/core/#Animator-getCurrentAnimatorState) method to get the currently playing `Animation State`. The parameter is the index `layerIndex` of the `AnimatorControllerLayer` where the `Animation State` is located. For details, see the [API documentation](/apis/core/#Animator-getCurrentAnimatorState). After obtaining it, you can set the properties of the `Animation State`, such as changing the default loop playback to play once.
You can use the [getCurrentAnimatorState](/apis/core/#Animator-getCurrentAnimatorState) method to get the currently playing `AnimatorState` . The parameter is the index `layerIndex` of the `AnimatorControllerLayer` where the `AnimatorState` is located. For details, see the [API documentation](/apis/core/#Animator-getCurrentAnimatorState). After obtaining it, you can set the properties of the `AnimatorState` , such as changing the default loop playback to play once.

```typescript
const currentState = animator.getCurrentAnimatorState(0);
Expand All @@ -142,7 +142,7 @@ currentState.wrapMode = WrapMode.Loop;

### Get Animation State

You can use the [findAnimatorState](/apis/core/#Animator-findAnimatorState) method to get the specified `Animation State`. After obtaining it, you can set the properties of the animation state, such as changing the default loop playback to play once.
You can use the [findAnimatorState](/apis/core/#Animator-findAnimatorState) method to get the specified `AnimatorState` . After obtaining it, you can set the properties of the `AnimatorState` , such as changing the default loop playback to play once.

```typescript
const state = animator.findAnimatorState("xxx");
Expand Down
6 changes: 3 additions & 3 deletions docs/en/animation/animatorController.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `AnimatorController` ([API](/apis/core/#AnimatorController)) helps you organ
`AnimatorControllerLayer` are used to organize and manage `AnimatorStateMachines` within an `AnimatorController`. Each `AnimatorControllerLayer` has its own `AnimatorStateMachine`. When the `Animator` component runs, all `AnimatorControllerLayer` run simultaneously, and multiple `AnimatorControllerLayer` achieve animation blending through different weights and blending modes. For detailed usage of `AnimatorControllerLayer`, please refer to the [AnimatorControllerLayer](/docs/animation/layer/) document.

#### AnimatorControllerParameter
`AnimatorControllerParameter` are used to control the switching of `AnimatorState` in the `AnimatorStateMachine`. When the conditions of the `AnimatorStateTransition` are met by setting the values of the `AnimatorControllerParameter`, the `AnimatorStateTransition` will trigger, switching to the target `Animation State`. For detailed usage of `AnimatorControllerParameter`, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document.
`AnimatorControllerParameter` are used to control the switching of `AnimatorState` in the `AnimatorStateMachine`. When the conditions of the `AnimatorStateTransition` are met by setting the values of the `AnimatorControllerParameter`, the `AnimatorStateTransition` will trigger, switching to the target `AnimatorState`. For detailed usage of `AnimatorControllerParameter`, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document.

## Editor Usage

Expand All @@ -32,11 +32,11 @@ Through the `AnimatorController` editor, users can organize the playback logic o

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QqpxS6I9D90AAAAAAAAAAAAADsJ_AQ/original" />

3. The newly created `AnimatorController` has no data. We need to edit it, double-click the asset, and add an `Animation State` ([detailed introduction](/docs/animation/state-machine/#动画状态)).
3. The newly created `AnimatorController` has no data. We need to edit it, double-click the asset, and add an `AnimatorState` ([detailed introduction](/docs/animation/state-machine/#动画状态)).

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*7bZmS4iZ10gAAAAAAAAAAAAADsJ_AQ/original" />

4. Click the added `Animation State` to bind an `AnimationClip` ([detailed introduction](/docs/animation/clip)).
4. Click the added `AnimatorState` to bind an `AnimationClip` ([detailed introduction](/docs/animation/clip)).

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*xfPTRJg-hOMAAAAAAAAAAAAADsJ_AQ/original" />

Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/examples/blending.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Click `+` in the `Layers` panel to add an `AnimatorControllerLayer`


## 2. Edit AnimatorControllerLayer
Add an `Animation State` (if you don't know how to add it, please refer to: [Play Animation in Model](/docs/animation/examples/playAnimation/)), bind the **"shakeHead"** `AnimationClip` in the model, and connect it from `entry` to this `Animation State`. You can adjust the transition time from `entry` to this `Animation State` as needed.
Add an `AnimatorState` (if you don't know how to add it, please refer to: [Play Animation in Model](/docs/animation/examples/playAnimation/)), bind the **"shakeHead"** `AnimationClip` in the model, and connect it from `entry` to this AnimatorState. You can adjust the transition time from `entry` to this `AnimatorState` as needed.

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*sdC9TbG6-VgAAAAAAAAAAAAADsJ_AQ/original" />

Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/examples/controlAnimationByInput.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The default value of the `Condition` meets our needs. When `speed` is greater th
<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*YjqXSb1EDaIAAAAAAAAAAAAADsJ_AQ/original" />

### 3. Add Script
We need a script to receive user input and modify the `speed` parameter value based on user input to trigger animation state transitions.
We need a script to receive user input and modify the `speed` parameter value based on user input to trigger `AnimatorStateTransition`.
There are two ways to add a script:

1. Right-click on the blank space in the **[Asset Panel](/docs/assets/interface)** and select `Create` -> `New Empty Script`
Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/examples/material-animation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Select the default `entity` created by the editor (you can also click the `+` bu
<Callout type="info">
The preparation work includes:
1. Creating an `Animator` component ([detailed introduction](/docs/animation/animator/)) for the selected `entity` and creating an `AnimatorController` ([detailed introduction](/docs/animation/animatorController/)) asset.
2. The `AnimatorController` will contain an `Animation State`, and the `Animation State` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
2. The `AnimatorController` will contain an AnimatorState, and the `AnimatorState` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
3. The `Animator` component will automatically bind the `AnimatorController`.
</Callout>

Expand Down
6 changes: 3 additions & 3 deletions docs/en/animation/examples/playAnimation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ There are two ways to create an `AnimatorController`:

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*v8aUR4McTA4AAAAAAAAAAAAADsJ_AQ/original" />

2. Click the add animation state button to add an animation state
2. Click the add `AnimatorState` button to add an `AnimatorState`

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*G1moSpo20KcAAAAAAAAAAAAADsJ_AQ/original" />

3. Click the animation state (for an introduction to the properties of the Animation State, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/#动画状态) document), and bind the AnimationClip.
3. Click the `AnimatorState` (for an introduction to the properties of the Animation State, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/#animation-state) document), and bind the AnimationClip.

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*GUdQQqCHE7cAAAAAAAAAAAAADsJ_AQ/original" />

4. Connect from `entry` to this `Animation State` and click the connection line to change the `Duration` to 0 (for a detailed introduction to Animation Transition, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document). This way, when this AnimatorController is applied, it will immediately play this animation state.
4. Connect from `entry` to this `AnimatorState` and click the connection line to change the `Duration` to 0 (for a detailed introduction to Animation Transition, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document). This way, when this AnimatorController is applied, it will immediately play this `AnimatorState`.

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wgBgQor0c5wAAAAAAAAAAAAADsJ_AQ/original" />

Expand Down
8 changes: 4 additions & 4 deletions docs/en/animation/examples/reuseAnimation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ Import the character model and animation model into the editor.

## 1. Create AnimatorController Asset
To play animations from other models, we need to edit the content of the `AnimatorController`. The `AnimatorController` in the model is read-only, so we need to create an `AnimatorController` ourselves.
If you don't know how to create an `AnimatorController`, please refer to: [Create AnimatorController](/docs/animation/examples/playAnimation/#2-创建动画控制资产)
If you don't know how to create an `AnimatorController`, please refer to: [Create AnimatorController](/docs/animation/examples/playAnimation/#2-create-animatorcontroller-asset)

## 2. Edit AnimatorController

1. Double-click the [AnimatorController](/docs/animation/animatorController/) asset to enter the AnimatorController editor (for an introduction to the functions of the editor, please refer to the [AnimatorController Editor](/docs/animation/animatorController/) document)

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*v8aUR4McTA4AAAAAAAAAAAAADsJ_AQ/original" />

2. Click the `Add Animation State` button to add an `Animation State`
2. Click the `Add Animation State` button to add an `AnimatorState`

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*G1moSpo20KcAAAAAAAAAAAAADsJ_AQ/original" />

3. Click the `Animation State` (for an introduction to the properties of the Animation State, please refer to the [AnimatorState](/docs/animation/animatorState/) document), and bind the `AnimationClip` from the animation model.
3. Click the `AnimatorState` (for an introduction to the properties of the Animation State, please refer to the [AnimatorState](/docs/animation/animatorState/) document), and bind the `AnimationClip` from the animation model.

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*72LhQ5gOBmgAAAAAAAAAAAAADsJ_AQ/original" />

4. Connect from `entry` to this `Animation State` and click the connection line to change the `Duration` to 0 (for a detailed introduction to Animation State and Animation Transition, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document). This way, when this AnimatorController is applied, it will immediately play this `Animation State`.
4. Connect from `entry` to this `AnimatorState` and click the connection line to change the `Duration` to 0 (for a detailed introduction to `AnimatorState` and Animation Transition, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document). This way, when this AnimatorController is applied, it will immediately play this `AnimatorState` .

<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wgBgQor0c5wAAAAAAAAAAAAADsJ_AQ/original" />
<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*NgW5QZ4vaFEAAAAAAAAAAAAADsJ_AQ/original" />
Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/examples/sprite-sheet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Select the default `entity` created by the editor (you can also click the `+` bu
<Callout type="info">
The preparation work includes:
1. Creating an `Animator` component ([detailed introduction](/docs/animation/animator/)) for the selected `entity` and creating an `AnimatorController` ([detailed introduction](/docs/animation/animatorController/)) asset.
2. The `AnimatorController` will contain an `Animation State`, and the `Animation State` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
2. The `AnimatorController` will contain an `AnimatorState` , and the `AnimatorState` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
3. The `Animator` component will automatically bind the `AnimatorController`.
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/examples/text-animation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Select the default `entity` created by the editor (you can also click the `+` bu
<Callout type="info">
The preparation work includes:
1. Creating an `Animator` component ([detailed introduction](/docs/animation/animator/)) for the selected `entity` and creating an `AnimatorController` ([detailed introduction](/docs/animation/animatorController/)) asset.
2. The `AnimatorController` will contain an `Animation State`, and the `Animation State` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
2. The `AnimatorController` will contain an AnimatorState, and the `AnimatorState` will automatically bind the selected `AnimationClip` and connect to the `entry` node (for a detailed introduction to the `entry` node, please refer to the [AnimatorStateMachine](/docs/animation/state-machine/) document).
3. The `Animator` component will automatically bind the `AnimatorController`.
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion docs/en/animation/layer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type: Animation
label: Animation
---

`AnimatorControllerLayer` ([API](/apis/core/#AnimatorControllerLayer)) is used to organize and manage `AnimatorStateMachine` ([see details](/docs/animation/state-machine/)) in an `Animation Controller` ([detailed introduction](/docs/animation/animatorController)). Each `AnimatorControllerLayer` has its own `Animation State Machine`. When the `Animation Control Component` runs, all `AnimatorControllerLayer` run simultaneously, controlling the overall animation effect through `blending weight` and `blending mode`.
`AnimatorControllerLayer` ([API](/apis/core/#AnimatorControllerLayer)) is used to organize and manage `AnimatorStateMachine` ([see details](/docs/animation/state-machine/)) in an `Animation Controller` ([detailed introduction](/docs/animation/animatorController)). Each `AnimatorControllerLayer` has its own `AnimatorStateMachine`. When the `Animator` Component runs, all `AnimatorControllerLayer` run simultaneously, controlling the overall animation effect through `blendingWeight` and `blendingMode`.

| Property | Description |
| :------- | :--------------------------------------------------------------------------------- |
Expand Down
10 changes: 5 additions & 5 deletions docs/en/animation/state-machine.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Represents a single state in the `AnimatorStateMachine`, i.e., the animation bei
| [StateMachineScripts](/apis/core/#StateMachineScript)| Allows developers to write custom script logic to execute specific code during different events (such as state enter, exit, update, etc.) of the AnimatorStateMachine. It is similar to Script but specifically for the AnimatorStateMachine. |

##### Three Special AnimatorState in the Editor
`entry`: Represents the entry point of the AnimatorStateMachine. When entering the AnimatorStateMachine, it always enters `entry` first, and then jumps to other states according to the defined transition conditions. `entry` itself does not play animations; it mainly connects the starting point of the state machine to the initial animation state. Typically, you should connect it to the default state of the character or animated object, such as the character's `Idle` state.
`entry`: Represents the entry point of the AnimatorStateMachine. When entering the AnimatorStateMachine, it always enters `entry` first, and then jumps to other states according to the defined transition conditions. `entry` itself does not play animations; it mainly connects the starting point of the state machine to the initial `AnimatorState` . Typically, you should connect it to the default state of the character or animated object, such as the character's `Idle` state.

`any`: Allows any state in the AnimatorStateMachine to transition to the target state when specific conditions are met. This is useful for handling global events or emergency animations (such as being injured or dying).

Expand Down Expand Up @@ -210,11 +210,11 @@ You can add `State Machine Scripts` to each `AnimatorState`, allowing you to rec
<Image src="https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*A7I7QqiDCfkAAAAAAAAAAAAADsJ_AQ/original" />

#### Script Usage
`StateMachineScript` provide three animation state cycles:
`StateMachineScript` provide three `AnimatorState` cycles:

- `onStateEnter`: Callback when the animation state starts playing.
- `onStateUpdate`: Callback when the animation state updates.
- `onStateExit`: Callback when the animation state ends.
- `onStateEnter`: Callback when the `AnimatorState` starts playing.
- `onStateUpdate`: Callback when the `AnimatorState` updates.
- `onStateExit`: Callback when the `AnimatorState` ends.

```typescript
class theScript extends StateMachineScript {
Expand Down
Loading

0 comments on commit 7b0cf5f

Please # to comment.