aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/sksg')
-rw-r--r--experimental/sksg/SkSGScene.cpp9
-rw-r--r--experimental/sksg/SkSGScene.h16
2 files changed, 23 insertions, 2 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;
}
diff --git a/experimental/sksg/SkSGScene.h b/experimental/sksg/SkSGScene.h
index 32186498d2..2081c1d747 100644
--- a/experimental/sksg/SkSGScene.h
+++ b/experimental/sksg/SkSGScene.h
@@ -39,6 +39,20 @@ private:
using INHERITED = SkNoncopyable;
};
+using AnimatorList = std::vector<std::unique_ptr<Animator>>;
+
+class GroupAnimator : public Animator {
+protected:
+ explicit GroupAnimator(AnimatorList&&);
+
+ void onTick(float t) override;
+
+private:
+ const AnimatorList fAnimators;
+
+ using INHERITED = Animator;
+};
+
/**
* Holds a scene root and a list of animators.
*
@@ -47,8 +61,6 @@ private:
*/
class Scene final : SkNoncopyable {
public:
- using AnimatorList = std::vector<std::unique_ptr<Animator>>;
-
static std::unique_ptr<Scene> Make(sk_sp<RenderNode> root, AnimatorList&& animators);
~Scene();