Class AnimatedValue
An function that applies an EasingBase function between two values.
Implements
Inherited Members
Namespace: SadConsole.Instructions
Assembly: SadConsole.dll
Syntax
public class AnimatedValue : Wait, IComponent
Constructors
AnimatedValue(TimeSpan, double, double, EasingBase?)
Creates a new value animated over time.
Declaration
public AnimatedValue(TimeSpan duration, double startingValue, double endingValue, EasingBase? easingFunction = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | duration | The total time this animation should run. |
double | startingValue | The starting value of the animation. |
double | endingValue | The ending value of the animation. |
EasingBase | easingFunction | The easing function used during animation. Defaults to Linear. |
Fields
EasingFunction
The easing function assigned to animate the value.
Declaration
protected EasingBase EasingFunction
Field Value
Type | Description |
---|---|
EasingBase |
Properties
EndingValue
The ending value of the animation.
Declaration
public double EndingValue { get; }
Property Value
Type | Description |
---|---|
double |
StartingValue
The stating value of the animation.
Declaration
public double StartingValue { get; }
Property Value
Type | Description |
---|---|
double |
Value
The current or last value of the animation.
Declaration
public double Value { get; }
Property Value
Type | Description |
---|---|
double |
Methods
Reset()
Resets the Done flag.
Declaration
public override void Reset()
Overrides
Remarks
On the base class, resets the IsFinished to false. Override this method to reset the derived class' counters and status flags for the instruction.
Reset(TimeSpan, double, double, EasingBase?)
Resets this object to new values.
Declaration
public void Reset(TimeSpan duration, double startingValue, double endingValue, EasingBase? easingFunction = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | duration | The total time this animation should run. |
double | startingValue | The starting value of the animation. |
double | endingValue | The ending value of the animation. |
EasingBase | easingFunction | The easing function used during animation. Defaults to Linear. |
Update(IScreenObject, TimeSpan)
Updates the timer with the time since the last call.
Declaration
public override void Update(IScreenObject console, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | console | The parent object. |
TimeSpan | delta | The time since the last frame update. |
Overrides
Events
ValueChanged
Raised when the instruction is running and the value changes during Update(IScreenObject, TimeSpan).
Declaration
public event EventHandler<double>? ValueChanged
Event Type
Type | Description |
---|---|
EventHandler<double> |