Skip to content
Alexandria W. edited this page Jul 8, 2025 · 6 revisions

AnimationTagsAPI

Important

This wiki expects that you read everything thoroughly. There's a high chance that what you're looking for is already documented in the wiki.

Warning

This library requires that it be required in every script that uses its functions.

require("AnimationTags")
Guide: Assigning Tags

Animations can be given tags by this API, which allows you to see if any animations with that tag are playing, and play/pause/stop all animations of a given tag.

To begin, we first need to assign tags to the animations.

require("AnimationTags") -- Require is needed before using any of this API's custom functions

animations.model.swing:addTags("Arms", "Right Arm")
animations.model.place:addTags("Arms", "Right Arm")
animations.model.punch:addTags("Arms", "Right Arm")

Animation tags can be managed by adding onto and removing the tags. Tags are global meaning all scripts can see and manage all tags an animation is given.

animations.model.punch:removeTags("Right Arm"):addTags("Left Arm")

The resulting tags for the example's animation would be Arms and Left Arm


Guide: Using Tags

Tags themselves are objects which store all animations with the tag. This is how you'll check if any animations are playing and manage animations with that tag.

It is recommended to run animations:getTags() right before you use it in a loop. If you're trying to check multiple tags, you can store the return of this function in a variable.

local tags = animations:getTags()
tags.Arms:stop() -- Stops all animations with the Arms tag
function events.tick()
  local tags = animations:getTags()
  if tags.Arms:isPlaying() then
    sounds:playSound("minecraft:block.note_block.bit", player:getPos())
  end
  if tags["Right Arm"]:isPlaying() then
    printTable(tags["Right Arm"]:getPlaying()) -- Print a table containing the currently playing animations with the Right Arm tag
  end
end

AnimationAPI

Figura's internal AnimationAPI class. AnimationTagsAPI adds new functions to it.

This is accessed using the animations global.

animations:getTags()
getTags()

Not to be confused with Animation getTags.

Returns all animation tags.

Tags can be indexed to access the tag object. Indexing a tag object in a loop or with a print results in a table with just animations associated with that tag.

local tags = animations:getTags()
printTable(tags.exampleTag) -- Table of animations

Running a method on the tag does so for all animations with the tag.

local tags = animations:getTags()
tags.exampleTag:play()
Annotations
getTags()

Returns:

Type Description
AnimationTag[] A list of all tags (their objects)

Animation

Figura's internal Animation objects. AnimationTagsAPI adds new functions to them.

This is accessed by indexing an animation.

animations.model.exampleAnimation:addTags()
getTags()

Not to be confused with AnimationAPI getTags.

Returns a table listing this animation's tags

printTable(animations.model.exampleAnimation:getTags()) -- Table of tag strings
Annotations
getTags()

Returns:

Type Description
table A list of this animation's tags

addTags()

Adds tags to this animation, which can be used to determine which tags have an animation playing

Any single animation can be assigned to several tags

animations.model.exampleAnimation:addTags("Example", "Player Animations")
Annotations
addTags(...)

Parameters:

$\color{#FF0000}{*}$ required

Name Type Description Default
tags string... - -

Returns:

Type Description
Animation Returns self for chaining

removeTags()

Removes tags from this animation

animations.model.exampleAnimation:removeTags("Example", "Player Animations")
Annotations
removeTags(...)

Parameters:

$\color{#FF0000}{*}$ required

Name Type Description Default
tags string... - -

Returns:

Type Description
Animation Returns self for chaining

AnimationTag

Object added by AnimationTagsAPI.

This is accessed by indexing animation tags by running animations:getTags() after assigning that tag to an animation with animations.model.exampleAnimation:setTags()

animations:getTags().exampleTag:stop()
isPlaying()

Get if any animation with this tag is playing

local tags = animations:getTags()
print(tags.exampleTag:isPlaying())
Annotations
isPlaying()

Returns:

Type Description
boolean -

getPlaying()

Returns the animations with this tag that are currently playing

local tags = animations:getTags()
printTable(tags.exampleTag:getPlaying())
Annotations
getPlaying()

Returns:

Type Description
Animation[] -

play()

Starts or resumes all animations with this tag

local tags = animations:getTags()
tags.exampleTag:play()
Annotations
play()

Returns:

Type Description
AnimationTag Returns self for chaining

playing()

Sets the playing state of all animations with this tag. Argument defaults to false

local tags = animations:getTags()
tags.exampleTag:playing(true)
Annotations
playing(state)

Parameters:

$\color{#FF0000}{*}$ required

Name Type Description Default
state boolean - false

Returns:

Type Description
AnimationTag Returns self for chaining

setPlaying()

Sets the playing state of all animations with this tag. Argument defaults to false

local tags = animations:getTags()
tags.exampleTag:setPlaying(true)
Annotations
setPlaying(state)

Parameters:

$\color{#FF0000}{*}$ required

Name Type Description Default
state boolean - false

Returns:

Type Description
AnimationTag Returns self for chaining

pause()

Pauses all animations with this tag

local tags = animations:getTags()
tags.exampleTag:pause()
Annotations
pause()

Returns:

Type Description
AnimationTag Returns self for chaining

stop()

Stops all animations with this tag

local tags = animations:getTags()
tags.exampleTag:stop()
Annotations
stop()

Returns:

Type Description
AnimationTag Returns self for chaining

restart()

Restarts all animations with this tag from the beginning, even if it was currently paused or playing

local tags = animations:getTags()
tags.exampleTag:restart()
Annotations
restart()

Returns:

Type Description
AnimationTag Returns self for chaining

Clone this wiki locally