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_STATIC

Animation type: static.
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_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_skeletal_slot(armobj) → {slot_1}

Get the first blended animation slot.
Parameters:
Name Type Description
armobj Object3D Armature object.
Returns:
First blended animation slot.
Type
slot_1
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_second_skeletal_slot(armobj) → {slot_2}

Get the second blended animation slot.
Parameters:
Name Type Description
armobj Object3D Armature object.
Returns:
Second blended animation slot.
Type
slot_2
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:

mix_from_cur_pos(armobj, slot, timeopt, callbackopt)

Set the mix factor for the skeletal animations assigned to the last two animation slots.
Parameters:
Name Type Attributes Default Description
armobj Object3D Armature object.
slot AnimSlot Animation slot number.
time number <optional>
0 Time interval for changing the mix factor from the current to the target value.
callback AnimBlendingCallback <optional>
null Callback to execute on finished blending.
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, callbackopt)

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.
callback AnimBlendingCallback <optional>
null Callback to execute on finished blending.
Source:

set_skeletal_slots(armobj, slot_1opt, slot_2opt, factoropt)

Set the blended skeletal animation slots.
Parameters:
Name Type Attributes Default Description
armobj Object3D Armature object.
slot_1 number <optional>
-1 First blended animation slot.
slot_2 number <optional>
-1 Second blended animation slot.
factor number <optional>
0 Start animation mix factor.
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

AnimBlendingCallback()

Animation blending finish callback.
Source:

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: