[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>
diff --git a/experimental/sksg/SkSGScene.cpp b/experimental/sksg/SkSGScene.cpp
index 85a1b43..8d7e0b3 100644
--- a/experimental/sksg/SkSGScene.cpp
+++ b/experimental/sksg/SkSGScene.cpp
@@ -22,6 +22,15 @@
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;
}