blob: 77be06b809138882ae5a91efd34c74deb6c08a85 [file] [log] [blame]
Florin Malita094ccde2017-12-30 12:27:00 -05001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Florin Malita54f65c42018-01-16 17:04:30 -05008#ifndef SkottieAnimator_DEFINED
9#define SkottieAnimator_DEFINED
Florin Malita094ccde2017-12-30 12:27:00 -050010
Florin Malita35efaa82018-01-22 12:57:06 -050011#include "SkSGScene.h"
Florin Malita094ccde2017-12-30 12:27:00 -050012
Florin Malita2518a0a2018-01-24 18:29:00 -050013#include <functional>
Florin Malitafc807c82018-01-25 22:35:09 -050014
15namespace Json { class Value; }
Florin Malita094ccde2017-12-30 12:27:00 -050016
Florin Malita54f65c42018-01-16 17:04:30 -050017namespace skottie {
Florin Malita094ccde2017-12-30 12:27:00 -050018
Florin Malitafc807c82018-01-25 22:35:09 -050019// This is the workhorse for property binding: depending on whether the property is animated,
20// it will either apply immediately or instantiate and attach a keyframe animator.
Florin Malita094ccde2017-12-30 12:27:00 -050021template <typename T>
Florin Malitafc807c82018-01-25 22:35:09 -050022bool BindProperty(const Json::Value&,
Florin Malitacca86f32018-01-29 10:49:49 -050023 sksg::AnimatorList*,
Florin Malitafc807c82018-01-25 22:35:09 -050024 std::function<void(const T&)>&&,
25 const T* noop = nullptr);
Florin Malita094ccde2017-12-30 12:27:00 -050026
Florin Malita54f65c42018-01-16 17:04:30 -050027} // namespace skottie
Florin Malita094ccde2017-12-30 12:27:00 -050028
Florin Malita54f65c42018-01-16 17:04:30 -050029#endif // SkottieAnimator_DEFINED