BBMOD_Animation

A constructor defined in BBMOD_Animation.gml

Extends BBMOD_Resource

new BBMOD_Animation([_file[, _sha1]])

Description

An animation which can be played using BBMOD_AnimationPlayer.

Arguments

Name Type Description
_file String A "*.bbanim" animation file to load. If not specified, then an empty animation is created.
_sha1 String Expected SHA1 of the file. If the actual one does not match with this, then the model will not be loaded.

Properties

Name Description
Duration The duration of the animation (in tics).
TicsPerSecond Number of animation tics per second.
TransitionIn Duration of transition into this animation (in seconds). Must be a value greater or equal to 0!
TransitionOut Duration of transition out of this animation (in seconds). Must be a value greater or equal to 0!
VersionMajor The major version of the animation file.
VersionMinor The minor version of the animation file.

Inherited properties

Name Description
IsLoaded If false then the resource has not been loaded yet.
Path The path to the file from which was the resource loaded, or undefined if the resource does not come from a file.
Persistent If true then the resource is persistent and it is not destroyed when method free is used. Default value is false.

Methods

Name Description
add_event Adds a custom animation event.
create_transition Creates a new animation transition.
from_buffer Loads animation data from a buffer.
get_animation_time Calculates animation time from current time in seconds.
supports_attachments Checks whether the animation supports bone attachments.
supports_bone_transform Checks whether the animation supports bone transformation through code.
supports_transitions Checks whether the animation supports transitions.
to_buffer Writes animation data to a buffer.

Inherited methods

Name Description
destroy Frees memory used by the struct.
free Releases a reference to the resource.
from_buffer Loads the resource from a buffer.
from_file Loads the resource from a file.
from_file_async Asynchronnously loads the resource from a file.
ref Retrieves a reference to the resource.
to_buffer Writes the resource to a buffer.
to_file Writes a resource to a file.

Throws

Example

Following code loads an animation from a file Walk.bbanim:

try
{
    animWalk = new BBMOD_Animation("Walk.bbanim");
}
catch (_exception)
{
    // The animation failed to load!
}

You can also load animations from buffers like so:

var _buffer = buffer_load("Walk.anim");
try
{
    animWalk = new BBMOD_Animation().from_buffer(_buffer);
}
catch (_exception)
{
    // Failed to load an animation from the buffer!
}
buffer_delete(_buffer);

See also

BBMOD_AnimationInstance, BBMOD_AnimationPlayer, BBMOD_AnimationState, BBMOD_AnimationStateMachine

Do you find this page helpful?

Copyright © 2024, BlueBurn. Built on July 03, 2024 using GMDoc.