Skip to content

✨ feat/new-helper-functions #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: corepack enable

- name: Install Dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Build
run: yarn build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function animated_java:<export_namespace>/summon {args: {}}
However, you may want to specify the position and rotation of the Rig Instance. To do this, you can change the execution context of the `summon` function:

```rust title=Summoning a Rig Instance at a specific position and rotation | copy
execute positioned <x> <y> <z> rotated <rx> <ry> run function animated_java:<export_namespace>/summon {args: {}}
execute positioned <x> <y> <z> rotated <rx> <ry> run \
function animated_java:<export_namespace>/summon {args: {}}
```

## Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,92 +38,6 @@ execute as @e[type=item_display,tag=aj.<export_namespace>.root] at @s run \
tp @s ~ ~5 ~ ~90 ~
```

## Controlling Animation Playback

Animation playback is controlled using functions. Each animation has a set of functions that can be called to control it. Animation functions _must_ be ran as the root entity of the Rig Instance.

### Play Function

Starts playing the animation from the beginning.

```rust title=Play the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/play
```

### Pause Function

Pauses the animation at the current frame.

```rust title=Pause the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/pause
```

### Resume Function

Resumes the animation from the current frame.

```rust title=Resume the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/resume
```

### Stop Function

Stops the animation and resets it to the beginning.

```rust title=Stop the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/stop
```

### Apply Frame Function

Sets the animation to a specific frame with interpolation.

#### Arguments

| Name | Type | Description |
| ------- | ------- | ---------------------------------- |
| `frame` | Integer | The frame to set the animation to. |

```rust title=Set the walk animation to frame 10 with interpolation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/apply_frame {frame: 10}
```

### Set Frame Function

Sets the animation to a specific frame instantly without interpolation.

#### Arguments

| Name | Type | Description |
| ------- | ------- | ---------------------------------- |
| `frame` | Integer | The frame to set the animation to. |

```rust title=Set the walk animation to frame 10 | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/set_frame {frame: 10}
```

#### Tween Function

Pauses all currently playing animations, and smoothly transitions to the target frame of this animation over the duration, then resumes the animation from the target frame.

#### Arguments

| Name | Type | Description |
| ---------- | ------- | ---------------------------------------- |
| `to_frame` | Integer | The frame of this animation to tween to. |
| `duration` | Integer | The duration of the tween in ticks. |

```rust title=Smoothly transition the walk animation to frame 10 over a second | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/walk/tween {to_frame: 10, duration: 20}
```

## Applying Variants

Variants can be applied to the Rig Instance using the desired Variant's `apply` function.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: Controlling Animation Playback
description: Learn how to control the playback of Animations.
---

# { $frontmatter.title }

{ $frontmatter.description }

Animation playback is controlled using functions. Each animation has a set of functions that can be called to control it. Animation functions _must_ be ran [as the root entity](/docs/rigs/controlling-a-rig-instance#selecting-the-rig-instance) of the Rig Instance.

### Play Function

Starts playing the animation from the beginning.

```rust title=Play the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/play
```

### Pause Function

Pauses the animation at the current frame.

```rust title=Pause the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/pause
```

### Resume Function

Resumes the animation from the current frame.

```rust title=Resume the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/resume
```

### Stop Function

Stops the animation and resets it to the beginning.

```rust title=Stop the walk animation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/stop
```

### Apply Frame Function

Sets the animation to a specific frame with interpolation.

#### Arguments

| Name | Type | Description |
| ------- | ------- | ---------------------------------- |
| `frame` | Integer | The frame to set the animation to. |

```rust title=Set the walk animation to frame 10 with interpolation | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/apply_frame {frame: 10}
```

### Set Frame Function

Sets the animation to a specific frame instantly without interpolation.

#### Arguments

| Name | Type | Description |
| ------- | ------- | ---------------------------------- |
| `frame` | Integer | The frame to set the animation to. |

```rust title=Set the walk animation to frame 10 | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/set_frame {frame: 10}
```

#### Tween Function

Pauses all currently playing animations, and smoothly transitions to the target frame of this animation over the duration, then resumes the animation from the target frame.

#### Arguments

| Name | Type | Description |
| ---------- | ------- | ---------------------------------------- |
| `to_frame` | Integer | The frame of this animation to tween to. |
| `duration` | Integer | The duration of the tween in ticks. |

```rust title=Smoothly transition the walk animation to frame 10 over a second | copy
execute as @e[type=item_display,tag=aj.<export_namespace>.root] run \
function animated_java:<export_namespace>/animations/<animation_name>/tween {to_frame: 10, duration: 20}
```
82 changes: 0 additions & 82 deletions src/routes/docs/[...4]rigs/[...4]locators/+page.md

This file was deleted.

31 changes: 0 additions & 31 deletions src/routes/docs/[...4]rigs/[...5]cameras/+page.md

This file was deleted.

Loading