API methods for animation.
Summary
Members
- AB_CYCLIC
- AB_FINISH_RESET
- AB_FINISH_STOP
- OBJ_ANIM_TYPE_ARMATURE
- OBJ_ANIM_TYPE_MATERIAL
- OBJ_ANIM_TYPE_NONE
- OBJ_ANIM_TYPE_OBJECT
- OBJ_ANIM_TYPE_PARTICLES
- OBJ_ANIM_TYPE_SOUND
- OBJ_ANIM_TYPE_STATIC
- OBJ_ANIM_TYPE_VERTEX
- SLOT_0
- SLOT_1
- SLOT_2
- SLOT_3
- SLOT_4
- SLOT_5
- SLOT_6
- SLOT_7
- SLOT_ALL
Methods
- apply(obj, name, slot_numopt)
- apply_def(obj)
- apply_ext(obj, name_listnullable, slot_numopt)
- apply_smoothing(obj, trans_periodopt, quat_periodopt, slot_numopt)
- apply_to_first_empty_slot(obj, name) → {number}
- frame_to_sec(frame) → {number}
- get_anim_length(obj, slot_numopt) → {number}
- get_anim_names(obj) → {Array.<string>}
- get_anim_start_frame(obj, slot_numopt) → {number}
- get_anim_type(obj, slot_numopt) → (nullable) {module:animation~AnimType}
- get_behavior(obj, slot_numopt) → {module:animation~AnimBehavior}
- get_current_anim_name(obj, slot_numopt) → (nullable) {string}
- get_first_skeletal_slot(armobj) → {slot_1}
- get_frame(obj, slot_numopt) → {number}
- get_second_skeletal_slot(armobj) → {slot_2}
- get_skel_mix_factor(armobj) → {number}
- get_slot_num_by_anim(obj, anim_name) → (nullable) {number}
- get_speed(obj, slot_numopt) → {number}
- is_animated(obj) → {boolean}
- is_play(obj, slot_numopt) → {boolean}
- mix_from_cur_pos(armobj, slot, timeopt, callbackopt)
- play(obj, finish_callbackopt, slot_numopt)
- remove(obj)
- remove_slot_animation(obj, slot_numopt)
- set_behavior(obj, behavior, slot_numopt)
- set_first_frame(obj, slot_numopt)
- set_frame(obj, frame, slot_numopt)
- set_last_frame(obj, slot_numopt)
- set_skel_mix_factor(armobj, factor, timeopt, callbackopt)
- set_skeletal_slots(armobj, slot_1opt, slot_2opt, factoropt)
- set_speed(obj, speed, slot_numopt)
- stop(obj, slot_numopt)
Type Definitions
Detailed Description
Members
AB_CYCLIC
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
OBJ_ANIM_TYPE_MATERIAL
OBJ_ANIM_TYPE_NONE
OBJ_ANIM_TYPE_OBJECT
OBJ_ANIM_TYPE_PARTICLES
OBJ_ANIM_TYPE_SOUND
OBJ_ANIM_TYPE_STATIC
OBJ_ANIM_TYPE_VERTEX
SLOT_0
SLOT_1
SLOT_2
SLOT_3
SLOT_4
SLOT_5
SLOT_6
SLOT_7
SLOT_ALL
Methods
apply(obj, name, slot_numopt)
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_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_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_anim_type(obj, slot_numopt) → (nullable) {AnimType}
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}
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_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}
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}
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)
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_frame(obj, frame, slot_numopt)
set_last_frame(obj, slot_numopt)
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)
stop(obj, slot_numopt)
Type Definitions
AnimBehavior
Animation behavior enum.
Type:
- number
AnimBlendingCallback()
Animation blending finish callback.
- Source: