Skip to content

format

typescript
Animator.CrossFade(name, normalized_transition_duration, layer_index, normalized_time_offset, normalized_transition_time)

class: Animator

description

Performs a smooth transition between the current animation state and the target animation state.

parameter

param_nametypedescription
namestringThe name of the target animation state.
normalized_transition_durationnumberThe duration of the transition in seconds.
layer_indexnumber?The index of the layer.
normalized_time_offsetnumber?The offset time of the state (normalized).
normalized_transition_timenumber?The transition time (normalized).

reture

typedescription
void

code example

typescript
let obj = new GameObject();
let animator = obj.AddComponent<Animator>(Animator);
animator.CrossFade("name",1,1,1,1);