lerp static method
Linearly interpolate between two CornerSpec objects.
If either is null
, defaults to CornerSpec.ROUNDED.
(If both are null
, this returns null
.)
The radius
is acquired by BorderRadiusGeometry.lerp.
For now, the four CornerSpec corners swap values from a
to b
according to an arbitrary keyframe along t
.
- TL:
t < 0.5
returnedCorners
are froma
, otherwise fromb
- TR:
t < 0.65
returnedCorners
are froma
, otherwise fromb
- BR:
t < 0.8
returnedCorners
are froma
, otherwise fromb
- BL:
t < 0.95
returnedCorners
are froma
, otherwise fromb
TODO: Find help.
Implementation
static CornerSpec? lerp(CornerSpec? a, CornerSpec? b, double t) {
if (a == null && b == null) return null;
a ??= CornerSpec.ROUNDED;
b ??= CornerSpec.ROUNDED;
return CornerSpec(
topLeft: t < 0.5 ? a.topLeft : b.topLeft,
topRight: t < 0.65 ? a.topRight : b.topRight,
bottomRight: t < 0.8 ? a.bottomRight : b.bottomRight,
bottomLeft: t < 0.95 ? a.bottomLeft : b.bottomLeft,
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
);
}