Flutter Engine
The Flutter Engine
VectorKeyframeAnimator.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 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
8#ifndef SkottieVectorKeyframeAnimator_DEFINED
9#define SkottieVectorKeyframeAnimator_DEFINED
10
13
14#include <cstddef>
15#include <vector>
16
17namespace skjson {
18class ArrayValue;
19class ObjectValue;
20class Value;
21} // namespace skjson
22
23namespace skottie {
24class ExpressionManager;
25}
26
27namespace skottie::internal {
28class AnimationBuilder;
29class Animator;
30
32public:
33 using VectorLenParser = bool(*)(const skjson::Value&, size_t*);
34 using VectorDataParser = bool(*)(const skjson::Value&, size_t, float*);
35
37
39 const skjson::ArrayValue&) override;
40
42
43private:
44 bool parseValue(const AnimationBuilder&, const skjson::Value&) const override;
45
46 bool parseKFValue(const AnimationBuilder&,
48 const skjson::Value&,
49 Keyframe::Value*) override;
50
51 const VectorLenParser fParseLen;
52 const VectorDataParser fParseData;
53
54 std::vector<float> fStorage;
55 size_t fVecLen, // size of individual vector values we store
56 fCurrentVec = 0; // vector value index being parsed (corresponding
57 // storage offset is fCurrentVec * fVecLen)
58 std::vector<float>* fTarget;
59
61};
62
63} // namespace skottie::internal
64
65#endif // SkottieVectorKeyframeAnimator_DEFINED
AnimatorBuilder(Keyframe::Value::Type ty)
bool(*)(const skjson::Value &, size_t, float *) VectorDataParser
sk_sp< Animator > makeFromExpression(ExpressionManager &, const char *) override
sk_sp< KeyframeAnimator > makeFromKeyframes(const AnimationBuilder &, const skjson::ArrayValue &) override
VectorAnimatorBuilder(std::vector< float > *, VectorLenParser, VectorDataParser)
bool(*)(const skjson::Value &, size_t *) VectorLenParser