Table of Contents

Class BindableAnimator

Namespace
Bindables
Assembly
Bindables.dll

A bindable animator that evaluates a curve over time and provides the animated value through the IBindable interface. Supports play, pause, reverse, and various loop modes for animation control.

public class BindableAnimator : IBindable<float>, IBindable
Inheritance
BindableAnimator
Implements
Inherited Members
Extension Methods

Constructors

BindableAnimator(Curve, float, float, bool, LoopType)

Creates a BindableAnimator class with the specified initial value and curve.

public BindableAnimator(Curve curve, float startValue = 0, float endValue = 1, bool autoPlay = false, BindableAnimator.LoopType loop = LoopType.None)

Parameters

curve Curve

The curve to use for animation evaluation.

startValue float

The initial value time == 0

endValue float

The final value when time == curve.Duration

autoPlay bool

If true, the animation will start playing immediately. Default is false.

loop BindableAnimator.LoopType

The loop type for the animation. Default is None.

Properties

CurrentTime

Gets or sets the current time position in the animation. The value is clamped between 0 and the curve's duration. Setting this property will update the current value.

public float CurrentTime { get; set; }

Property Value

float

Curve

Gets or sets the curve used for animation evaluation. Setting this property will update the current value.

public Curve Curve { get; set; }

Property Value

Curve

EndValue

public float EndValue { get; set; }

Property Value

float

IsPlaying

Whether the animation is currently playing.

public bool IsPlaying { get; }

Property Value

bool

IsReverse

Whether the animation is set to play in reverse.

public bool IsReverse { get; }

Property Value

bool

Loop

Gets or sets the loop type for the animation.

public BindableAnimator.LoopType Loop { get; set; }

Property Value

BindableAnimator.LoopType

StartValue

public float StartValue { get; set; }

Property Value

float

Value

Gets the current value of the animation based on the curve evaluation at the current time.

public float Value { get; }

Property Value

float

Methods

BindTransition(IBindable<bool>)

Binds a boolean transition that will control the animation playback. When the transition value is true, the animation plays forward; when false, it plays in reverse.

public void BindTransition(IBindable<bool> transition)

Parameters

transition IBindable<bool>

The bindable boolean to use for controlling animation direction. Pass null to unbind.

Pause()

Pauses the animation at the current time position.

public void Pause()

Play(bool)

Starts playing the animation in the forward direction.

public void Play(bool playFromBeginning = false)

Parameters

playFromBeginning bool

If true, resets the current time to 0 before playing. Default is false.

Play(float, float)

Updates the start and end values and plays the animation in the forward direction.

public void Play(float startValue, float endValue)

Parameters

startValue float

Initial value

endValue float

Final value

PlayReverse(bool)

Starts playing the animation in the reverse direction.

public void PlayReverse(bool playFromEnd = false)

Parameters

playFromEnd bool

If true, resets the current time to the curve's duration before playing. Default is false.

PlayReverse(float, float)

Updates the start and end values and plays the animation in the reverse direction.

public void PlayReverse(float startValue, float endValue)

Parameters

startValue float

Initial value

endValue float

Final value

WaitForCompleteAsync()

Awaitable method to wait until the currently running animation to complete or is stopped. Looping animations do not complete.

public Task WaitForCompleteAsync()

Returns

Task

Events

OnChange

Event triggered when the bindable value changes.

public event Action OnChange

Event Type

Action

OnChangeWithValue

Event triggered when the bindable value changes, providing the new value.

public event Action<float> OnChangeWithValue

Event Type

Action<float>