Class SplineAnimate
A component for animating an object along a Spline.
Inherited Members
Namespace: UnityEngine.Splines
Syntax
[AddComponentMenu("Splines/Spline Animate")]
public class SplineAnimate : SplineComponent
Properties
Alignment
The way the object should align when animating along the Spline. See SplineAnimate.AlignmentMode for details.
Declaration
public SplineAnimate.AlignmentMode Alignment { get; set; }
Property Value
Type | Description |
---|---|
SplineAnimate.AlignmentMode |
AnimationMethod
The method used to traverse the Spline. See SplineAnimate.Method for details.
Declaration
public SplineAnimate.Method AnimationMethod { get; set; }
Property Value
Type | Description |
---|---|
SplineAnimate.Method |
Container
The target Spline to follow.
Declaration
public SplineContainer Container { get; set; }
Property Value
Type | Description |
---|---|
SplineContainer |
Duration
The time (in seconds) it takes to traverse the Spline once.
Declaration
public float Duration { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
When animation method is set to Time this setter will set the Duration value and automatically recalculate MaxSpeed, otherwise, it will have no effect.
Easing
Easing mode used when animating the object along the Spline. See SplineAnimate.EasingMode for details.
Declaration
public SplineAnimate.EasingMode Easing { get; set; }
Property Value
Type | Description |
---|---|
SplineAnimate.EasingMode |
ElapsedTime
Total time (in seconds) since the start of Spline's traversal.
Declaration
public float ElapsedTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
IsPlaying
Returns true if object is currently animating along the Spline.
Declaration
public bool IsPlaying { get; }
Property Value
Type | Description |
---|---|
Boolean |
Loop
The way the Spline should be looped. See SplineAnimate.LoopMode for details.
Declaration
public SplineAnimate.LoopMode Loop { get; set; }
Property Value
Type | Description |
---|---|
SplineAnimate.LoopMode |
MaxSpeed
The maxSpeed speed (in Unity units/second) that the Spline traversal will advance in.
Declaration
public float MaxSpeed { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
If SplineAnimate.EasingMode is to None then the Spline will be traversed at MaxSpeed throughout its length. Otherwise, the traversal speed will range from 0 to MaxSpeed throughout the Spline's length depending on the easing mode set. When animation method is set to Speed this setter will set the MaxSpeed value and automatically recalculate Duration, otherwise, it will have no effect.
NormalizedTime
Normalized time of the Spline's traversal. The integer part is the number of times the Spline has been traversed. The fractional part is the % (0-1) of progress in the current loop.
Declaration
public float NormalizedTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
ObjectForwardAxis
Object space axis that should be considered as the object's forward vector.
Declaration
public SplineComponent.AlignAxis ObjectForwardAxis { get; set; }
Property Value
Type | Description |
---|---|
SplineComponent.AlignAxis |
ObjectUpAxis
Object space axis that should be considered as the object's up vector.
Declaration
public SplineComponent.AlignAxis ObjectUpAxis { get; set; }
Property Value
Type | Description |
---|---|
SplineComponent.AlignAxis |
PlayOnAwake
If true, transform will automatically start following the target Spline on awake.
Declaration
public bool PlayOnAwake { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Pause()
Pause object's animation along the Spline.
Declaration
public void Pause()
Play()
Begin animating object along the Spline.
Declaration
public void Play()
Restart(Boolean)
Stop the animation and place the object at the beginning of the Spline.
Declaration
public void Restart(bool autoplay)
Parameters
Type | Name | Description |
---|---|---|
Boolean | autoplay | If true, the animation along the Spline will start over again. |
Update()
Evaluates the animation along the Spline based on deltaTime.
Declaration
public void Update()
Events
Updated
Invoked each time object's animation along the Spline is updated.
Declaration
public event Action<Vector3, Quaternion> Updated
Event Type
Type | Description |
---|---|
Action<Vector3, Quaternion> |