lerp static method
SliceDataStyle?
lerp(
- SliceDataStyle? current,
- SliceDataStyle? target,
- double donutRadius,
- double t,
Lerps between two SliceDataStyle's for a factor t
Implementation
static SliceDataStyle? lerp(
SliceDataStyle? current,
SliceDataStyle? target,
double donutRadius,
double t,
) {
if (target != null) {
var shouldLerpFromDonut =
donutRadius > 0.0 && donutRadius > (current?.radius ?? 0);
var beginRadius = shouldLerpFromDonut ? donutRadius : current?.radius;
var beginLabel =
shouldLerpFromDonut ? donutRadius : current?.labelPosition;
return SliceDataStyle(
radius: lerpDouble(beginRadius, target.radius, t) ?? 0,
labelPosition: lerpDouble(beginLabel, target.labelPosition, t),
color: Color.lerp(current?.color, target.color, t),
gradient: Gradient.lerp(current?.gradient, target.gradient, t),
strokeWidth: lerpDouble(current?.strokeWidth, target.strokeWidth, t),
strokeColor: Color.lerp(current?.strokeColor, target.strokeColor, t),
);
}
return null;
}