Class ValueSpeedAnimation<T>
A simple speed animation which only changes a value over time.
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: AnimationHelpers
Assembly: cs.temp.dll.dll
Syntax
public class ValueSpeedAnimation<T> : SpeedAnimationSequence, IAnmationSequence
Type Parameters
Name | Description |
---|---|
T | The type of the value to animate |
Constructors
ValueSpeedAnimation(Single, Single, Func<Single, T>, Boolean)
Create a new instance of ValueSpeedAnimation The t value for the interpolation is calculated as follow:
travelTime * speed / travelDistance
Declaration
public ValueSpeedAnimation(float speed, float distance, Func<float, T> lerpFunction, bool reversed = false)
Parameters
Type | Name | Description |
---|---|---|
System.Single | speed | A multiplier which will be applied to the time the animation is running. |
System.Single | distance | The distance the animation needs to travel |
Func<System.Single, T> | lerpFunction | A function which takes a float as the parameter t of the interpolation and outputs the value T |
System.Boolean | reversed | If true start the animation in reversed state |
Properties
CurrentValue
Returns the last calculated value.
Declaration
public T CurrentValue { get; }
Property Value
Type | Description |
---|---|
T |
Methods
AnimationStep(Single)
Declaration
protected override void AnimationStep(float t)
Parameters
Type | Name | Description |
---|---|---|
System.Single | t |
Overrides
CalculateCurrentValue(out Boolean)
Calculate the value for the current time. This will call UpdateAnimation and the returns the CurrentValue
Declaration
public T CalculateCurrentValue(out bool isActive)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isActive | false when the animation is finished |
Returns
Type | Description |
---|---|
T | The current value |