AnimatableValue<T> class

A generic class that represents an animatable value between a start and an end value.

This class extends Animatable and provides a way to interpolate between two values of type T using a custom linear interpolation function.

The lerp function is used to calculate the interpolated value based on the given progress t, which should be a value between 0.0 and 1.0.

Example usage:

final animatable = AnimatableValue<double>(
  start: 0.0,
  end: 100.0,
  lerp: (a, b, t) => a + (b - a) * t,
);
final valueAtHalfway = animatable.transform(0.5); // 50.0

Type Parameters:

  • T: The type of the animatable value.

Properties:

  • start: The starting value of the animation.
  • end: The ending value of the animation.
  • lerp: A function that defines how to interpolate between start and end.

Methods:

Inheritance

Constructors

AnimatableValue({required T start, required T end, required T lerp(T a, T b, double t)})
A class that represents an animatable value with a start and end value, and a function to interpolate between them.

Properties

end → T
The ending value of the animation.
final
hashCode int
The hash code for this object.
no setteroverride
lerp → T Function(T a, T b, double t)
A function that interpolates between two values of type T.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start → T
The starting value of the animation.
final

Methods

animate(Animation<double> parent) Animation<T>
Returns a new Animation that is driven by the given animation but that takes on values determined by this object.
inherited
chain(Animatable<double> parent) Animatable<T>
Returns a new Animatable whose value is determined by first evaluating the given parent and then evaluating this object at the result.
inherited
evaluate(Animation<double> animation) → T
The current value of this object for the given Animation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
transform(double t) → T
Returns the value of the object at point t.
override

Operators

operator ==(Object other) bool
The equality operator.
override