Animations
game.Animations: the game's own clips, and animations written as keys in Lua for bones and for things.
The Explorer searches everything on this page, and the classes of the game too.
game.Animations
game.Animations: the game's own clips on anything with a skeleton, and animations written as keys in Lua.
Type name: WaxAnimations.
game.Animations:Play(target?, clip, options?)
Plays one of the game's own montages or sequences on a character or a creature. For the player's own character give { first = path, third = path }: the arms and the body are two skeletons with clips of their own.
game.Animations:Play(target?: any, clip: string|{ first?: string, third?: string }, options?: WaxClipOptions): WaxClipPlay| Parameter | Type | Description |
|---|---|---|
target (optional) | any | A character or a creature. game.Me when omitted. |
clip | string | { first?: string, third?: string } | The path of a montage or a sequence of the game. |
options (optional) | WaxClipOptions |
Returns WaxClipPlay
game.Animations:Define(name, spec)
Makes an animation from keys. Nothing is asked of the game until it plays.
game.Animations:Define(name: string, spec: WaxAnimationSpec): WaxAnimation| Parameter | Type |
|---|---|
name | string |
spec | WaxAnimationSpec |
Returns WaxAnimation
game.Animations:Get(name)
The animation of that name, or nil.
game.Animations:Get(name: string): WaxAnimation?| Parameter | Type |
|---|---|
name | string |
Returns WaxAnimation?
game.Animations:GetBones(target?)
The names of the bones of a target's skeleton, for writing tracks.
game.Animations:GetBones(target?: any): string[]| Parameter | Type | Description |
|---|---|---|
target (optional) | any | game.Me when omitted. |
Returns string[]
game.Animations:Find(text)
The paths of the game's montages and sequences whose path holds every word given. At most 200, then how many there were.
game.Animations:Find(text: string): string[], integer| Parameter | Type | Description |
|---|---|---|
text | string | Words such as "1st sledge montage". |
Returns
string[](paths)integer(total)
game.Animations:StopAll()
Stops every animation your mod is playing.
game.Animations:StopAll()Returns nothing.
WaxAnimationPlay
An animation that is playing.
You get one from model:Play, animation:Play. Below, play stands for one of these.
| Property | Type | Description |
|---|---|---|
Animation | WaxAnimation | An animation written as keys, as game.Animations:Define gives it. It can play on any number of targets at once. |
play:Stop()
Stops it now. A thing moved by a Self track goes back to where it was.
play:Stop()Returns nothing.
play:IsPlaying()
play:IsPlaying(): booleanReturns boolean
play:GetTime()
play:GetTime(): numberReturns number (seconds)
play:SetRate(rate)
play:SetRate(rate: number)| Parameter | Type | Description |
|---|---|---|
rate | number | More than 0. |
Returns nothing.
WaxAnimation
An animation written as keys, as game.Animations:Define gives it. It can play on any number of targets at once.
You get one from game.Animations:Define, game.Animations:Get. Below, animation stands for one of these.
| Property | Type | Description |
|---|---|---|
Name | string | |
Length | number | Seconds. |
Loop | boolean |
animation:Play(target?, options?)
Plays the animation. On a character or a creature its bone tracks move the bones, added to whatever the game is animating at that moment. On a thing of a blueprint or a part, its Self track moves the thing as a whole. On the player's own character it shows on the arms in first person and on the body in third. It costs nothing while nothing plays, and it stops when your mod unloads.
animation:Play(target?: any, options?: WaxAnimationPlayOptions): WaxAnimationPlay| Parameter | Type | Description |
|---|---|---|
target (optional) | any | A character, a creature, a thing of a blueprint or a part. game.Me when omitted. |
options (optional) | WaxAnimationPlayOptions |
Returns WaxAnimationPlay
WaxClipPlay
One of the game's clips that was started.
You get one from game.Animations:Play. Below, clip stands for one of these.
clip:Stop(blend?)
clip:Stop(blend?: number)| Parameter | Type | Description |
|---|---|---|
blend (optional) | number | Seconds to blend out. |
Returns nothing.
clip:IsPlaying()
clip:IsPlaying(): booleanReturns boolean
WaxAnimationKey
One moment of a track. The first entry is the time in seconds, the second what is added at that time, the third how the way there is eased: "linear", "smooth", "in", "out" or "snap".
| Field | Type | Description |
|---|---|---|
any other key ([1]) | number | The time, in seconds from the start. |
any other key ([2]) | WaxAnimationValues | What is added to the bone or the thing at that time. |
WaxAnimationValues
What a key adds. Everything is an offset from where the bone or the thing is without the animation, so a key of {} means "as the game has it".
| Field | Type | Description |
|---|---|---|
Pitch (optional) | number | Degrees about the character's right: positive tips back, negative leans forward. |
Yaw (optional) | number | Degrees about up: positive turns to the right. |
Roll (optional) | number | Degrees about forward. |
X (optional) | number | |
Y (optional) | number | |
Z (optional) | number | |
Scale (optional) | number | 1 leaves the size as it is. |
WaxAnimationSpec
What game.Animations:Define makes an animation from.
Used by game.Animations:Define.
| Field | Type | Description |
|---|---|---|
tracks | table<string, WaxAnimationKey[]> | What moves, by name: a bone ("RightShoulder", or the name its skeleton gives it), or Self for the thing as a whole. |
third (optional) | table<string, WaxAnimationKey[]> | Tracks for the player's body seen in third person, when they should differ from tracks. |
reach (optional) | table<string, WaxAnimationKey[]|WaxReach> | Where the end of a limb goes: RightHand, LeftHand, RightFoot or LeftFoot. The two bones above it are bent to get it there. |
reach_from (optional) | "hand" | "shoulder" | "hand" (when omitted): a reach key adds to where the limb's end is. "shoulder": a key says where it is, forward, right and up of the limb's root, and the reach comes in from the game's pose and goes back to it. |
reach_blend (optional) | number | number[] | With reach_from = "shoulder": the seconds a reach takes to come in from the game's pose, and to go back. One number for both, or { in, out }. 0.15 when omitted. |
length (optional) | number | How long it runs, in seconds. The time of the last key when omitted. |
loop (optional) | boolean | True starts it again when it ends. |
ease (optional) | "linear" | "smooth" | "in" | "out" | "snap" | How keys are eased when a key does not say. "smooth" when omitted. |
events (optional) | { [1]: number, [2]: fun(play: WaxAnimationPlay) }[] | Functions that run when the animation passes a time. |
WaxReach
A reach that also turns the end of the limb.
| Field | Type | Description |
|---|---|---|
keys | WaxAnimationKey[] | X, Y and Z say where the end goes. Pitch, Yaw and Roll say how it is turned. |
pin (optional) | boolean | True holds the limb's end where the game has it, in place and in turn, whatever the bones above it do: a foot stays flat on the ground while the hips sink and turn. Keys are not needed then. |
bend (optional) | { X: number, Y: number, Z: number } | number[] | Which way the elbow or the knee points: forward, right and up. |
bones (optional) | string[] | The limb's own three bones, from its root to its end, for a skeleton that is not a person's. |
straight (optional) | boolean | True moves the end in straight lines between keys. When omitted it moves on a curve through them. |
from (optional) | "hand" | "shoulder" | What this limb's keys are measured from, when it differs from the animation's reach_from. |
turn (optional) | boolean | True uses Pitch, Yaw and Roll: with reach_from = "shoulder" they are the turn of what the hand holds, as the character stands. Otherwise they are added. |
WaxAnimationPlayOptions
What animation:Play takes besides the target.
Used by model:Play, animation:Play.
| Option | Type | Description |
|---|---|---|
rate | number | How fast it runs. 1 when omitted. |
loop | boolean | Overrides the animation's own loop. |
weight | number | How much of the movement is added. 1 when omitted. |
keep | boolean | True leaves a thing where its Self track put it when the animation ends. |
done | fun(play: WaxAnimationPlay) | Runs when the animation has run to its end. Not when it is stopped. |
view | "first" | "third" | On the player's own character: the one view it shows in. Both when omitted. |
WaxClipOptions
What game.Animations:Play takes besides the clip.
Used by game.Animations:Play.
| Option | Type | Description |
|---|---|---|
rate | number | How fast it plays. 1 when omitted. |
blend | number | Seconds to blend in and out. 0.15 when omitted. |
start | number | Where in the clip it starts, in seconds. |
slot | string | The slot a single sequence plays in. "DefaultSlot" when omitted. |
loops | integer | How often a single sequence plays. 1 when omitted. |
part | string | { first?: string, third?: string } | The part of a montage to play, by its name in the game, such as "Action_0". |
match | boolean | With first and third given: false lets each clip run at its own length. When omitted the body's clip is paced to last as long as the arms'. |