|
13 | 13 |
|
14 | 14 | ## New Features
|
15 | 15 |
|
| 16 | +### (2024-04-23) Custom AnimationSet actions: |
| 17 | + |
| 18 | +- Introduces support for defining custom actions in the animations set and invoking them using the setCustomAnimation function. |
| 19 | + |
| 20 | +#### Usage Example: |
| 21 | + |
| 22 | +```js |
| 23 | +import { useGame } from "ecctrl"; |
| 24 | + |
| 25 | +const animationSet = { |
| 26 | + idle: "Idle", |
| 27 | + walk: "Walk", |
| 28 | + run: "Run", |
| 29 | + ..... |
| 30 | + // Custom action |
| 31 | + custom: { |
| 32 | + fly: "Fly" |
| 33 | + } |
| 34 | +}; |
| 35 | + |
| 36 | +// ... |
| 37 | +const setCustomAnimation = useGame((state) => state.setCustomAnimation); |
| 38 | +// ... |
| 39 | +setCustomAnimation("fly"); |
| 40 | +``` |
| 41 | + |
| 42 | +#### Note: |
| 43 | + |
| 44 | +Ensure to update your `animationSet` accordingly to include any custom animations you wish to use in your game. |
| 45 | + |
16 | 46 | ### (2024-1-1) EcctrlMode:
|
17 | 47 |
|
18 | 48 | - Now you can seamlessly switch between different modes by adding "mode" inside Ecctrl.
|
@@ -170,8 +200,8 @@ EcctrlProps: {
|
170 | 200 | autoBalance: true, // Enable auto-balance
|
171 | 201 | autoBalanceSpringK: 0.3, // Auto-balance spring constant
|
172 | 202 | autoBalanceDampingC: 0.03, // Auto-balance damping coefficient
|
173 |
| - autoBalanceSpringOnY: 0.5, // Auto-balance spring on Y-axis |
174 |
| - autoBalanceDampingOnY: 0.015, // Auto-balance damping on Y-axis |
| 203 | + autoBalanceSpringOnY: 0.5, // Auto-balance spring on Y-axis |
| 204 | + autoBalanceDampingOnY: 0.015, // Auto-balance damping on Y-axis |
175 | 205 | // Animation temporary setups
|
176 | 206 | animated: false, // Enable animation
|
177 | 207 | // Mode setups
|
@@ -425,7 +455,7 @@ pressButton1();
|
425 | 455 |
|
426 | 456 | ### Ecctrl Mode
|
427 | 457 |
|
428 |
| -Activate different modes in Ecctrl by including the desired mode inside Ecctrl component: |
| 458 | +Activate different modes in Ecctrl by including the desired mode inside Ecctrl component: |
429 | 459 | `<Ecctrl mode="PointToMove">`.
|
430 | 460 |
|
431 | 461 | #### 1. "PointToMove" Mode ([CodeSandbox Demo](https://codesandbox.io/p/sandbox/ecctrl-pointtomove-m9z6xh?file=%2Fsrc%2FMap.js%3A46%2C19))
|
|
0 commit comments