lerpToBox static method
Implementation
static AuroraDecorationMix lerpToBox(
AuroraDecoration a, BoxDecoration b, double t) {
List<Gradient> gradients = [];
List<double> blurs = [];
if (b.gradient != null) {
gradients.add(b.gradient!.scale(t));
blurs.add(0.0);
}
gradients = [
...?a.gradients?.map((e) => e.scale(1 - t)).toList(),
...gradients
];
blurs = [...?a.gradientBlurs, ...blurs];
DecorationImage? bImageAtT;
if (b.image != null) {
DecorationImage bImage = b.image!;
bImageAtT = DecorationImage(
image: bImage.image,
onError: bImage.onError,
colorFilter: bImage.colorFilter,
fit: bImage.fit,
alignment: bImage.alignment,
centerSlice: bImage.centerSlice,
repeat: bImage.repeat,
matchTextDirection: bImage.matchTextDirection,
scale: bImage.scale,
opacity: lerpDouble(0, bImage.opacity, t) ?? 0,
filterQuality: bImage.filterQuality,
invertColors: bImage.invertColors,
isAntiAlias: bImage.isAntiAlias,
);
}
return AuroraDecorationMix(
color: Color.lerp(a.color, b.color, t),
border: BoxBorder.lerp(a.border, b.border, t),
borderRadius:
BorderRadiusGeometry.lerp(a.borderRadius, b.borderRadius, t),
boxShadow: BoxShadow.lerpList(a.boxShadow, b.boxShadow, t),
gradients: gradients,
gradientBlurs: blurs,
image: bImageAtT,
shape: t < 0.5 ? a.shape : b.shape,
);
}