aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/skottie/src/SkottieAnimator.h
blob: 23bd9aa50022e2e7c450609e0436335ac99958b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkottieAnimator_DEFINED
#define SkottieAnimator_DEFINED

#include "SkSGScene.h"

#include <functional>

namespace skjson { class Value; }

namespace skottie {

// This is the workhorse for property binding: depending on whether the property is animated,
// it will either apply immediately or instantiate and attach a keyframe animator.
template <typename T>
bool BindProperty(const skjson::Value&,
                  sksg::AnimatorList*,
                  std::function<void(const T&)>&&,
                  const T* default_igore = nullptr);

template <typename T>
bool BindProperty(const skjson::Value& jv,
                  sksg::AnimatorList* animators,
                  std::function<void(const T&)>&& apply,
                  const T& default_ignore) {
    return BindProperty(jv, animators, std::move(apply), &default_ignore);
}

} // namespace skottie

#endif // SkottieAnimator_DEFINED