- override
Sets the action to a specific point in time. The t
value that is passed
in is a normalized value 0.0 to 1.0 of the duration of the action. Every
action will always recieve a callback with the end time point (1.0),
unless it is cancelled.
Source
@override void update(double t) { int p; double lt; if (t < 0.0) t = 0.0; if (t >= 1.0) { p = points.length - 1; lt = 1.0; } else { p = (t / _dt).floor(); lt = (t - _dt * p) / _dt; } Point p0 = points[(p - 1).clamp(0, points.length - 1)]; Point p1 = points[(p + 0).clamp(0, points.length - 1)]; Point p2 = points[(p + 1).clamp(0, points.length - 1)]; Point p3 = points[(p + 2).clamp(0, points.length - 1)]; Point newPos = _cardinalSplineAt(p0, p1, p2, p3, tension, lt); setter(newPos); }