AnimationMixerLayer
Lens Studio v1.0.0+
Inherits from ScriptObject
Description
Controls animation playback for a single animation layer. See also: AnimationMixer.
Methods
clone(String newName)
: AnimationMixerLayer
Returns a copy of this AnimationMixerLayer, with the name changed to newName
.
getDuration()
: Number
Returns the length of the animation in seconds.
getTime()
: Number
Returns the current playback position of the animation in seconds.
isPlaying()
: Boolean
Returns whether the animation is currently playing.
pause()
: void
Pauses the animation.
resume()
: void
Resumes the animation if it has been paused.
start(Number offset, Number cycles)
: void
Starts playing the animation with an offset of offsetArg
seconds. The animation will play cycles
times, or loop forever if cycles
is -1.
startWithCallback(Number offset, Number cycles, function(String name, AnimationMixer animationMixer) eventCallback)
: void
Starts the animation with an offset of offsetArg
seconds. The animation will play cycles
times, or loop forever if cycles
is -1.
eventCallback
will be called after the animation finishes.
stop()
: void
Stops the animation from playing and jumps to the animation’s end.
Properties
animationLayerName
: String
The name of the animation layer being used for this animation.
cycles
: Number
The number of times this animation will play. If -1, the animation will loop forever.
disabled
: Boolean
If true, the animation will stop having an effect.
fps
: Number
The framerate (frames per second) of the animation.
from
: Number
The starting point for this animation clip. If rangeType
is set to Time
, this is the point to start at in seconds. If rangeType
is set to Frames
, this is the frame number to start at.
name
: String
The name of the AnimationMixerLayer.
postInfinity
: AnimationClip.PostInfinity
Defines the animation’s looping behavior. If set to AnimationClip.PostInfinity.Cycle
, the animation will restart from the beginning each time it loops. If set to AnimationClip.PostInfinity.Oscillate
, the animation will switch between normal and reverse playback each time it loops. This is set to Cycle
by default.
rangeType
: AnimationClip.RangeType
The range type used for defining the animation clip. If set to AnimationClip.RangeType.Time
, to
and from
represent times in seconds. If set to AnimationClip.RangeType.Frames
, to
and from
represent frame numbers.
reversed
: Boolean
If true, the animation will play play in reverse.
speedRatio
: Number
A multiplying value for the speed of this animation. For example, a value of 2.0 will double animation speed, while a value of 0.5 will cut the speed in half.
to
: Number
The ending point for this animation clip. If rangeType
is set to Time
, this is the point to end at in seconds. If rangeType
is set to Frames
, this is the frame number to end at.
weight
: Number
The weight of this animation layer. Range is from [0-1], 0 being no animation strength and 1 being full animation strength.
Inherited Methods
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Examples
// Double the speed of the first AnimationMixerLayer and play it once
//@input Component.AnimationMixer mixer
var layer = script.mixer.getLayers()[0];
layer.speedRatio = 2.0;
layer.start(0, 1);
Still Looking for help?
Visit Support