diff options
author | Florin Malita <fmalita@chromium.org> | 2018-01-29 10:49:49 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-29 16:16:21 +0000 |
commit | cca86f386cfd050cd03a25b305fc6fda48a8d6cd (patch) | |
tree | ed86f775c14946e84eefbb8cfe248c12ed7136ce /experimental/sksg/SkSGScene.cpp | |
parent | a6717ce9fe02e1a251eaa39aa096dd90c6975f26 (diff) |
[skottie] Hierarchical animators
Instead of a flat animator space, introduce animator groups.
This allows us to encapsulate layer animators and only dispatch ticks
when their owning layer is active.
TBR=
Change-Id: I1fc8a55abf68a712b71969bb1a11275dbe54c236
Reviewed-on: https://skia-review.googlesource.com/101201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/sksg/SkSGScene.cpp')
-rw-r--r-- | experimental/sksg/SkSGScene.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/experimental/sksg/SkSGScene.cpp b/experimental/sksg/SkSGScene.cpp index 85a1b43b1c..8d7e0b369b 100644 --- a/experimental/sksg/SkSGScene.cpp +++ b/experimental/sksg/SkSGScene.cpp @@ -22,6 +22,15 @@ void Animator::tick(float t) { this->onTick(t); } +GroupAnimator::GroupAnimator(AnimatorList&& animators) + : fAnimators(std::move(animators)) {} + +void GroupAnimator::onTick(float t) { + for (const auto& a : fAnimators) { + a->tick(t); + } +} + std::unique_ptr<Scene> Scene::Make(sk_sp<RenderNode> root, AnimatorList&& anims) { return root ? std::unique_ptr<Scene>(new Scene(std::move(root), std::move(anims))) : nullptr; } |