lerp static method

ILengthValue? lerp(
  1. ILengthValue? from,
  2. ILengthValue? to,
  3. double t
)

Interpolates two potentially different length units after they resolve.

A missing endpoint is treated as a zero-pixel length while the animation is in progress. Exact endpoints retain their original nullable values.

Implementation

static ILengthValue? lerp(
  ILengthValue? from,
  ILengthValue? to,
  double t,
) {
  if (t <= 0.0) return from;
  if (t >= 1.0) return to;
  if (from == null && to == null) return null;
  if (from == to) return from;
  return Lp(from ?? const Px(0), to ?? const Px(0), t);
}