transformInternal method Null safety
- double t
override
Returns the value of the curve at point t
.
The given parametric value t
will be between 0.0 and 1.0, inclusive.
Implementation
@override
double transformInternal(double t) {
final bool firstCurve = t < midpoint.dx;
final double scaleX = firstCurve ? midpoint.dx : 1.0 - midpoint.dx;
final double scaleY = firstCurve ? midpoint.dy : 1.0 - midpoint.dy;
final double scaledT = (t - (firstCurve ? 0.0 : midpoint.dx)) / scaleX;
if (firstCurve) {
return Cubic(
a1.dx / scaleX,
a1.dy / scaleY,
b1.dx / scaleX,
b1.dy / scaleY,
).transform(scaledT) * scaleY;
} else {
return Cubic(
(a2.dx - midpoint.dx) / scaleX,
(a2.dy - midpoint.dy) / scaleY,
(b2.dx - midpoint.dx) / scaleX,
(b2.dy - midpoint.dy) / scaleY,
).transform(scaledT) * scaleY + midpoint.dy;
}
}