Module: animation

Summary

Members

Methods

Type Definitions

Detailed Description

Members

AB_CYCLIC

Animation behavior: cyclic.
Type:
Source:

AB_FINISH_RESET

Animation behavior: go back to the zero frame after finishing.
Type:
Source:

AB_FINISH_STOP

Animation behavior: stop the animation after finishing.
Type:
Source:

OBJ_ANIM_TYPE_ARMATURE

Animation type: armature.
Type:
Source:

OBJ_ANIM_TYPE_MATERIAL

Animation type: material.
Type:
Source:

OBJ_ANIM_TYPE_NONE

Animation type: none.
Type:
Source:

OBJ_ANIM_TYPE_OBJECT

Animation type: object.
Type:
Source:

OBJ_ANIM_TYPE_PARTICLES

Animation type: particles.
Type:
Source:

OBJ_ANIM_TYPE_SOUND

Animation type: sound.
Type:
Source:

OBJ_ANIM_TYPE_VERTEX

Animation type: vertex.
Type:
Source:

SLOT_0

Object's animation slot 0.
Type:
Source:

SLOT_1

Object's animation slot 1.
Type:
Source:

SLOT_2

Object's animation slot 2.
Type:
Source:

SLOT_3

Object's animation slot 3.
Type:
Source:

SLOT_4

Object's animation slot 4.
Type:
Source:

SLOT_5

Object's animation slot 5.
Type:
Source:

SLOT_6

Object's animation slot 6.
Type:
Source:

SLOT_7

Object's animation slot 7.
Type:
Source:

SLOT_ALL

All object's animation slots.
Type:
Source:

Methods

apply(obj, name, slot_numopt)

Apply the animation to the object.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
name String Animation name
slot_num AnimSlot <optional>
SLOT_0 Animation slot number.
Source:

apply_def(obj)

Apply the default animation (i.e. assigned in Blender) to the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Source:

apply_ext(obj, name_listnullable, slot_numopt)

Apply the animation to the object.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
name_list Array.<String> <nullable>
Array of material and nested groups names and animation name.
slot_num AnimSlot <optional>
SLOT_0 Animation slot number.
Source:

apply_smoothing(obj, trans_periodopt, quat_periodopt, slot_numopt)

Apply smoothing to the object's animation. In order to disable the smoothing, specify the zero periods.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
trans_period Number <optional>
0 Translation smoothing period
quat_period Number <optional>
0 Rotation smoothing period
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

apply_to_first_empty_slot(obj, name) → {Number}

Apply the animation to the first available animation slot.
Parameters:
Name Type Description
obj Object3D Object 3D
name String Animation name.
Returns:
Slot number or -1 if no empty slots found.
Type
Number
Source:

frame_to_sec(frame) → {Number}

Convert animation frames to seconds.
Parameters:
Name Type Description
frame Number Frame number
Returns:
Number of seconds
Type
Number
Source:

get_anim_length(obj, slot_numopt) → {Number}

Get the length of the object's animation measured in frames.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Animation length or -1 for incorrect object
Type
Number
Source:

get_anim_names(obj) → {Array.<String>}

Return the names of all available animations.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Array of animation names.
Type
Array.<String>
Source:

get_anim_start_frame(obj, slot_numopt) → {Number}

Get the starting frame of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Animation start frame or -1 for incorrect object
Type
Number
Source:

get_anim_type(obj, slot_numopt) → (nullable) {AnimType}

Get the object's animation type.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Slot number
Returns:
Animation type
Type
AnimType
Source:

get_behavior(obj, slot_numopt) → {AnimBehavior}

Get behavior of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Behavior enum
Type
AnimBehavior
Source:

get_bone_translation(armobj, bone_name, destopt)

Get the translation of the armature's bone.
Parameters:
Name Type Attributes Description
armobj Object3D Armature object
bone_name String Bone name
dest Vec3 <optional>
Destination vector
Deprecated:
Source:

get_current_anim_name(obj, slot_numopt) → (nullable) {String}

Return the name of the applied animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Current animation name or null.
Type
String
Source:

get_first_armature_object(obj) → (nullable) {Object3D}

Get the first armature object used for skinning of the given mesh object.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Armature object or null
Type
Object3D
Deprecated:
  • Unused
Source:

get_frame(obj, slot_numopt) → {Number}

Get the current frame of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Current frame
Type
Number
Source:

get_skel_mix_factor(armobj) → {Number}

Get the mix factor for the skeletal animations assigned to the last two animation slots.
Parameters:
Name Type Description
armobj Object3D Armature object.
Returns:
Mix factor.
Type
Number
Source:

get_slot_num_by_anim(obj, anim_name) → (nullable) {Number}

Get the slot number of the object to which the animation is assigned.
Parameters:
Name Type Description
obj Object3D Object 3D
anim_name String Animation name
Returns:
Animation slot number
Type
Number
Source:

get_speed(obj, slot_numopt) → {Number}

Get the speed of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Animation speed.
Type
Number
Source:

is_animated(obj) → {Boolean}

Check if the object is animated.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
Boolean
Source:

is_play(obj, slot_numopt) → {Boolean}

Check if the object's animation is being played back.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Returns:
Checking result.
Type
Boolean
Source:

play(obj, finish_callbackopt, slot_numopt)

Play the object's animation. The animation must be applied to the object before, or the object must have the default animation (i.e. assigned in Blender).
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
finish_callback AnimFinishCallback <optional>
Callback to execute on finished animation
slot_num AnimSlot <optional>
SLOT_0 Animation slot number.
Source:

remove(obj)

Remove the animation from the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Source:

remove_slot_animation(obj, slot_numopt)

Remove the animation from the given animation slot of the object.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number.
Source:

set_behavior(obj, behavior, slot_numopt)

Set behavior for the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
behavior AnimBehavior Behavior enum
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

set_first_frame(obj, slot_numopt)

Set the first frame of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

set_frame(obj, frame, slot_numopt)

Set the current frame of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
frame Number Current frame (float)
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

set_last_frame(obj, slot_numopt)

Set the last frame of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

set_skel_mix_factor(armobj, factor, timeopt)

Set the mix factor for the skeletal animations assigned to the last two animation slots. Specify the non-zero time for smooth animation transitions.
Parameters:
Name Type Attributes Default Description
armobj Object3D Armature object.
factor Number Target animation mix factor.
time Number <optional>
0 Time interval for changing the mix factor from the current to the target value.
Source:

set_speed(obj, speed, slot_numopt)

Set the speed of the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
speed Number Speed (may be negative) (float)
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

stop(obj, slot_numopt)

Stop the object's animation.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
slot_num AnimSlot <optional>
SLOT_0 Animation slot number
Source:

Type Definitions

AnimFinishCallback(obj, slot_num)

Animation finish callback.
Parameters:
Name Type Description
obj Object3D Animated object.
slot_num AnimSlot Animation slot.
Source:

AnimSlot

Animation slot enum. One of SLOT_*.
Type:
  • Number
Source:

AnimType

Animation type enum. One of OBJ_ANIM_TYPE_*.
Type:
  • Number
Source: