lerp method
Linearly interpolates between two Effects. This is used to animate
between two Effects. The value
argument is a fraction that
determines the position of this effect between this and other
.
If a Curve is provided to the parent AnimatableEffect
, the value
will be interpolated by the Curve. Otherwise, the value
will be
interpolated linearly.
The implementation should return this if value
is 0.0 and other
if value
is 1.0. Otherwise, returns an Effect that is a combination
of this and other
by interpolating between them.
clampedValue
is the clamped value of value
between 0.0 and 1.0, if
desired.
If no parent AnimatableEffect
or ScrollTransition is provided, then
this method is called with other
being the same as this effectively
nullifying the effect.
Check out ScaleEffect.lerp for an example of how to implement this method.
Returns a new Effect that is a combination of this and other
. This
returned Effect is then applied to the Widget by calling apply.
Implementation
@override
TranslateEffect lerp(covariant TranslateEffect other, double value) {
return TranslateEffect(
offset: Offset.lerp(offset, other.offset, value) ?? Offset.zero,
);
}