lerpFrom method
Linearly interpolate between this element and from
.
Implementation
@override
SplineElement lerpFrom(covariant SplineElement from, double t) {
final cubicsRst = <List<Offset>>[];
var fromCubics = from.cubics;
var toCubics = cubics;
final dl = toCubics.length - fromCubics.length;
if (dl > 0) {
fromCubics = [...fromCubics, ...List.filled(dl, fromCubics.last)];
} else if (dl < 0) {
toCubics = [...toCubics, ...List.filled(-dl, toCubics.last)];
}
for (var i = 0; i < toCubics.length; i++) {
cubicsRst.add([
Offset.lerp(fromCubics[i][0], toCubics[i][0], t)!,
Offset.lerp(fromCubics[i][1], toCubics[i][1], t)!,
Offset.lerp(fromCubics[i][2], toCubics[i][2], t)!,
]);
}
return SplineElement(
start: Offset.lerp(from.start, start, t)!,
cubics: cubicsRst,
style: style.lerpFrom(from.style, t),
rotation: lerpDouble(from.rotation, rotation, t),
rotationAxis: Offset.lerp(from.rotationAxis, rotationAxis, t),
tag: tag,
);
}