Skip to main content

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:

NameTypeDescription
stateNamestringThe name of the state.
normalizedTransitionDurationnumberThe duration of the transition (normalized).
layernumberThe layer where the crossfade occurs.
normalizedTimeOffsetnumberThe time of the state (normalized).
normalizedTransitionTimenumberThe 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.