lerp method

  1. @override
BoxSpec lerp(
  1. covariant BoxSpec? other,
  2. double t
)
override

Linearly interpolates between two BoxSpec instances.

The parameter t represents the interpolation factor, typically ranging from 0.0 to 1.0.

Implementation

@override
BoxSpec lerp(BoxSpec? other, double t) {
  if (other == null) return this;

  return BoxSpec(
    alignment: AlignmentGeometry.lerp(alignment, other.alignment, t),
    padding: EdgeInsetsGeometry.lerp(padding, other.padding, t),
    margin: EdgeInsetsGeometry.lerp(margin, other.margin, t),
    constraints: BoxConstraints.lerp(constraints, other.constraints, t),
    decoration: Decoration.lerp(decoration, other.decoration, t),
    foregroundDecoration: Decoration.lerp(
      foregroundDecoration,
      other.foregroundDecoration,
      t,
    ),
    transform: lerpMatrix4(transform, other.transform, t),
    transformAlignment: AlignmentGeometry.lerp(
      transformAlignment,
      other.transformAlignment,
      t,
    ),
    clipBehavior: lerpSnap(clipBehavior, other.clipBehavior, t),
    width: lerpDouble(width, other.width, t),
    height: lerpDouble(height, other.height, t),
    // Animated data does not have to be lerped
    animated: lerpSnap(animated, other.animated, t),
  );
}