diff options
author | Florin Malita <fmalita@chromium.org> | 2018-05-29 13:46:54 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-29 18:58:16 +0000 |
commit | a33447dab9b9ebdc0bd636b6ec7721557d21feac (patch) | |
tree | c549453a952ab1b888e1392f42d64bb29f5e516e /modules/skottie/include | |
parent | aec79e6f85cf40af1c784a7b5b40ba0d67be1727 (diff) |
[skottie] Animation::animationTick() -> Animation::seek()
Replace poorly defined animationTick() with a normalized seek() method.
TBR=
Change-Id: Id2ea17bb426fe86fede0d6c8a3d93236902f10af
Reviewed-on: https://skia-review.googlesource.com/130508
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'modules/skottie/include')
-rw-r--r-- | modules/skottie/include/Skottie.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/skottie/include/Skottie.h b/modules/skottie/include/Skottie.h index 0a89ca0438..906ea82b68 100644 --- a/modules/skottie/include/Skottie.h +++ b/modules/skottie/include/Skottie.h @@ -48,9 +48,27 @@ public: ~Animation() override; - void render(SkCanvas*, const SkRect* dst = nullptr) const; - - void animationTick(SkMSec); + /** + * Draws the current animation frame. + * + * @param canvas destination canvas + * @param dst optional destination rect + */ + void render(SkCanvas* canvas, const SkRect* dst = nullptr) const; + + /** + * Updates the animation state for |t|. + * + * @param t normalized [0..1] frame selector, where 0 == inPoint and 1 == outPoint. + */ + void seek(SkScalar t); + + /** + * Returns the animation duration in seconds. + */ + SkScalar duration() const { + return (fOutPoint - fInPoint) / fFrameRate; + } const SkString& version() const { return fVersion; } const SkSize& size() const { return fSize; } |