lerpFromBox static method
Implementation
static AuroraDecorationMix lerpFromBox(
BoxDecoration a, AuroraDecoration b, double t) {
List<Gradient> gradients = [];
List<double> blurs = [];
if (a.gradient != null) {
gradients.add(a.gradient!.scale(1 - t));
blurs.add(0.0);
}
gradients = [
...gradients,
...?b.gradients?.map((e) => e.scale(t)).toList()
];
blurs = [...blurs, ...?b.gradientBlurs];
DecorationImage? aImageAtT;
if (a.image != null) {
DecorationImage aImage = a.image!;
aImageAtT = DecorationImage(
image: aImage.image,
onError: aImage.onError,
colorFilter: aImage.colorFilter,
fit: aImage.fit,
alignment: aImage.alignment,
centerSlice: aImage.centerSlice,
repeat: aImage.repeat,
matchTextDirection: aImage.matchTextDirection,
scale: aImage.scale,
opacity: lerpDouble(aImage.opacity, 0, t) ?? 0,
filterQuality: aImage.filterQuality,
invertColors: aImage.invertColors,
isAntiAlias: aImage.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: aImageAtT,
shape: t < 0.5 ? a.shape : b.shape,
);
}