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 /tools/viewer/SkottieSlide.cpp | |
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 'tools/viewer/SkottieSlide.cpp')
-rw-r--r-- | tools/viewer/SkottieSlide.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/viewer/SkottieSlide.cpp b/tools/viewer/SkottieSlide.cpp index f009066182..8eecf43c98 100644 --- a/tools/viewer/SkottieSlide.cpp +++ b/tools/viewer/SkottieSlide.cpp @@ -13,6 +13,8 @@ #include "SkCanvas.h" #include "Skottie.h" +#include <cmath> + static void draw_stats_box(SkCanvas* canvas, const skottie::Animation::Stats& stats) { static constexpr SkRect kR = { 10, 10, 280, 120 }; static constexpr SkScalar kTextSize = 20; @@ -101,8 +103,9 @@ bool SkottieSlide::animate(const SkAnimTimer& timer) { } if (fAnimation) { - auto t = timer.msec() - fTimeBase; - fAnimation->animationTick(t); + const auto t = timer.msec() - fTimeBase; + const auto d = fAnimation->duration() * 1000; + fAnimation->seek(std::fmod(t, d) / d); } return true; } |