Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
property_resolver.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_SCENE_ANIMATION_PROPERTY_RESOLVER_H_
6#define FLUTTER_IMPELLER_SCENE_ANIMATION_PROPERTY_RESOLVER_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "flutter/fml/hash_combine.h"
13#include "flutter/fml/macros.h"
20
21namespace impeller {
22namespace scene {
23
24class Node;
25class TranslationTimelineResolver;
26class RotationTimelineResolver;
27class ScaleTimelineResolver;
28
30 public:
31 static std::unique_ptr<TranslationTimelineResolver> MakeTranslationTimeline(
32 std::vector<Scalar> times,
33 std::vector<Vector3> values);
34
35 static std::unique_ptr<RotationTimelineResolver> MakeRotationTimeline(
36 std::vector<Scalar> times,
37 std::vector<Quaternion> values);
38
39 static std::unique_ptr<ScaleTimelineResolver> MakeScaleTimeline(
40 std::vector<Scalar> times,
41 std::vector<Vector3> values);
42
44
45 virtual SecondsF GetEndTime() = 0;
46
47 /// @brief Resolve and apply the property value to a target node. This
48 /// operation is additive; a given node property may be amended by
49 /// many different PropertyResolvers prior to rendering. For example,
50 /// an AnimationPlayer may blend multiple Animations together by
51 /// applying several AnimationClips.
53 SecondsF time,
54 Scalar weight) = 0;
55};
56
58 public:
60
61 // |Resolver|
63
64 protected:
65 struct TimelineKey {
66 /// The index of the closest previous keyframe.
67 size_t index = 0;
68 /// Used to interpolate between the resolved values for `timeline_index - 1`
69 /// and `timeline_index`. The range of this value should always be `0>N>=1`.
71 };
73
74 std::vector<Scalar> times_;
75};
76
78 public:
80
81 // |Resolver|
83 SecondsF time,
84 Scalar weight) override;
85
86 private:
88
89 std::vector<Vector3> values_;
90
92
94 delete;
95
96 friend PropertyResolver;
97};
98
100 public:
102
103 // |Resolver|
105 SecondsF time,
106 Scalar weight) override;
107
108 private:
110
111 std::vector<Quaternion> values_;
112
114
115 RotationTimelineResolver& operator=(const RotationTimelineResolver&) = delete;
116
117 friend PropertyResolver;
118};
119
121 public:
123
124 // |Resolver|
126 SecondsF time,
127 Scalar weight) override;
128
129 private:
131
132 std::vector<Vector3> values_;
133
135
136 ScaleTimelineResolver& operator=(const ScaleTimelineResolver&) = delete;
137
138 friend PropertyResolver;
139};
140
141} // namespace scene
142} // namespace impeller
143
144#endif // FLUTTER_IMPELLER_SCENE_ANIMATION_PROPERTY_RESOLVER_H_
static SkISize times(const SkISize &size, float factor)
static std::unique_ptr< RotationTimelineResolver > MakeRotationTimeline(std::vector< Scalar > times, std::vector< Quaternion > values)
static std::unique_ptr< ScaleTimelineResolver > MakeScaleTimeline(std::vector< Scalar > times, std::vector< Vector3 > values)
static std::unique_ptr< TranslationTimelineResolver > MakeTranslationTimeline(std::vector< Scalar > times, std::vector< Vector3 > values)
virtual SecondsF GetEndTime()=0
virtual void Apply(AnimationTransforms &target, SecondsF time, Scalar weight)=0
Resolve and apply the property value to a target node. This operation is additive; a given node prope...
void Apply(AnimationTransforms &target, SecondsF time, Scalar weight) override
Resolve and apply the property value to a target node. This operation is additive; a given node prope...
void Apply(AnimationTransforms &target, SecondsF time, Scalar weight) override
Resolve and apply the property value to a target node. This operation is additive; a given node prope...
TimelineKey GetTimelineKey(SecondsF time)
void Apply(AnimationTransforms &target, SecondsF time, Scalar weight) override
Resolve and apply the property value to a target node. This operation is additive; a given node prope...
uint32_t * target
Definition dart.idl:29
float Scalar
Definition scalar.h:18
std::chrono::duration< float > SecondsF
Definition timing.h:13
size_t index
The index of the closest previous keyframe.