diff options
Diffstat (limited to 'experimental/skotty/SkottyAnimator.cpp')
-rw-r--r-- | experimental/skotty/SkottyAnimator.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/experimental/skotty/SkottyAnimator.cpp b/experimental/skotty/SkottyAnimator.cpp index 451f146888..d4c5c96c1a 100644 --- a/experimental/skotty/SkottyAnimator.cpp +++ b/experimental/skotty/SkottyAnimator.cpp @@ -42,4 +42,16 @@ void KeyframeInterval<ShapeValue>::lerp(float t, ShapeValue* v) const { SkAssertResult(fV1.fPath.interpolate(fV0.fPath, t, &v->fPath)); } +float AnimatorBase::ComputeLocalT(float t, float t0, float t1, + const SkPoint& c0, const SkPoint& c1) { + SkASSERT(t1 > t0); + auto lt = (t - t0) / (t1 - t0); + + if (c0 != SkPoint({0, 0}) || c1 != SkPoint({1, 1})) { + // TODO: lt = CubicBezier(lt, c0, c1); + } + + return SkTPin<float>(lt, 0, 1); +} + } // namespace skotty |