updateAnimationPercent method
void
updateAnimationPercent(
- PointRendererElement<
D> previous, - PointRendererElement<
D> target, - double animationPercent
Implementation
void updateAnimationPercent(
PointRendererElement<D> previous,
PointRendererElement<D> target,
double animationPercent,
) {
final targetPoint = target.point!;
final previousPoint = previous.point!;
final x = ((targetPoint.x! - previousPoint.x!) * animationPercent) +
previousPoint.x!;
final xLower = targetPoint.xLower != null && previousPoint.xLower != null
? ((targetPoint.xLower! - previousPoint.xLower!) * animationPercent) +
previousPoint.xLower!
: null;
final xUpper = targetPoint.xUpper != null && previousPoint.xUpper != null
? ((targetPoint.xUpper! - previousPoint.xUpper!) * animationPercent) +
previousPoint.xUpper!
: null;
double? y;
if (targetPoint.y != null && previousPoint.y != null) {
y = ((targetPoint.y! - previousPoint.y!) * animationPercent) +
previousPoint.y!;
} else if (targetPoint.y != null) {
y = targetPoint.y;
} else {
y = null;
}
final yLower = targetPoint.yLower != null && previousPoint.yLower != null
? ((targetPoint.yLower! - previousPoint.yLower!) * animationPercent) +
previousPoint.yLower!
: null;
final yUpper = targetPoint.yUpper != null && previousPoint.yUpper != null
? ((targetPoint.yUpper! - previousPoint.yUpper!) * animationPercent) +
previousPoint.yUpper!
: null;
point = DatumPoint<D>.from(
targetPoint,
x: x,
xLower: xLower,
xUpper: xUpper,
y: y,
yLower: yLower,
yUpper: yUpper,
);
color = getAnimatedColor(previous.color!, target.color!, animationPercent);
fillColor = getAnimatedColor(
previous.fillColor!,
target.fillColor!,
animationPercent,
);
radiusPx = (target.radiusPx - previous.radiusPx) * animationPercent +
previous.radiusPx;
boundsLineRadiusPx =
((target.boundsLineRadiusPx - previous.boundsLineRadiusPx) *
animationPercent) +
previous.boundsLineRadiusPx;
strokeWidthPx =
((target.strokeWidthPx - previous.strokeWidthPx) * animationPercent) +
previous.strokeWidthPx;
}