[skotty] Add cubic Bezier lerp stubs
... and refactor some of the keyframe parsing.
TBR=
Change-Id: If45922eab36412908036401cee693202f5c3e281
Reviewed-on: https://skia-review.googlesource.com/91100
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/experimental/skotty/SkottyAnimator.cpp b/experimental/skotty/SkottyAnimator.cpp
index 451f146..d4c5c96 100644
--- a/experimental/skotty/SkottyAnimator.cpp
+++ b/experimental/skotty/SkottyAnimator.cpp
@@ -42,4 +42,16 @@
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