Skip to content

Api > Animator > CrossFade()


Animator.CrossFade(string stateName, number normalizedTransitionDuration, number layer = -1, number normalizedTimeOffset = 0, number normalizedTransitionTime = 0)⚓︎

Creates a crossfade from the current state to any other state using normalized times.

Parameters:⚓︎

Name Type Description
stateName string The name of the state.
normalizedTransitionDuration number The duration of the transition (normalized).
layer number The layer where the crossfade occurs.
normalizedTimeOffset number The time of the state (normalized).
normalizedTransitionTime number The time of the transition (normalized).

Usage⚓︎

---@type Animator
local animator;

---@type string
local stateName;

---@type number
local normalizedTransitionDuration;

---@type number
local layer;

---@type number
local normalizedTimeOffset;

---@type number
local normalizedTransitionTime;


animator.CrossFade(stateName, normalizedTransitionDuration, layer, normalizedTimeOffset, normalizedTransitionTime)

Extra Detail⚓︎

When you specify a state name, or the string used to generate a hash, it should include the name of the parent layer. For example, if you have a Run state in the Base Layer, the name is Base Layer.Run.