OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 5 #ifndef CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 6 #define CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "cc/animation/animation_curve.h" | 12 #include "cc/animation/animation_curve.h" |
| 13 #include "cc/animation/animation_export.h" |
13 #include "cc/animation/timing_function.h" | 14 #include "cc/animation/timing_function.h" |
14 #include "cc/animation/transform_operations.h" | 15 #include "cc/animation/transform_operations.h" |
15 #include "cc/base/cc_export.h" | |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 | 18 |
19 class CC_EXPORT Keyframe { | 19 class CC_ANIMATION_EXPORT Keyframe { |
20 public: | 20 public: |
21 base::TimeDelta Time() const; | 21 base::TimeDelta Time() const; |
22 const TimingFunction* timing_function() const { | 22 const TimingFunction* timing_function() const { |
23 return timing_function_.get(); | 23 return timing_function_.get(); |
24 } | 24 } |
25 | 25 |
26 protected: | 26 protected: |
27 Keyframe(base::TimeDelta time, | 27 Keyframe(base::TimeDelta time, |
28 std::unique_ptr<TimingFunction> timing_function); | 28 std::unique_ptr<TimingFunction> timing_function); |
29 virtual ~Keyframe(); | 29 virtual ~Keyframe(); |
30 | 30 |
31 private: | 31 private: |
32 base::TimeDelta time_; | 32 base::TimeDelta time_; |
33 std::unique_ptr<TimingFunction> timing_function_; | 33 std::unique_ptr<TimingFunction> timing_function_; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(Keyframe); | 35 DISALLOW_COPY_AND_ASSIGN(Keyframe); |
36 }; | 36 }; |
37 | 37 |
38 class CC_EXPORT ColorKeyframe : public Keyframe { | 38 class CC_ANIMATION_EXPORT ColorKeyframe : public Keyframe { |
39 public: | 39 public: |
40 static std::unique_ptr<ColorKeyframe> Create( | 40 static std::unique_ptr<ColorKeyframe> Create( |
41 base::TimeDelta time, | 41 base::TimeDelta time, |
42 SkColor value, | 42 SkColor value, |
43 std::unique_ptr<TimingFunction> timing_function); | 43 std::unique_ptr<TimingFunction> timing_function); |
44 ~ColorKeyframe() override; | 44 ~ColorKeyframe() override; |
45 | 45 |
46 SkColor Value() const; | 46 SkColor Value() const; |
47 | 47 |
48 std::unique_ptr<ColorKeyframe> Clone() const; | 48 std::unique_ptr<ColorKeyframe> Clone() const; |
49 | 49 |
50 private: | 50 private: |
51 ColorKeyframe(base::TimeDelta time, | 51 ColorKeyframe(base::TimeDelta time, |
52 SkColor value, | 52 SkColor value, |
53 std::unique_ptr<TimingFunction> timing_function); | 53 std::unique_ptr<TimingFunction> timing_function); |
54 | 54 |
55 SkColor value_; | 55 SkColor value_; |
56 }; | 56 }; |
57 | 57 |
58 class CC_EXPORT FloatKeyframe : public Keyframe { | 58 class CC_ANIMATION_EXPORT FloatKeyframe : public Keyframe { |
59 public: | 59 public: |
60 static std::unique_ptr<FloatKeyframe> Create( | 60 static std::unique_ptr<FloatKeyframe> Create( |
61 base::TimeDelta time, | 61 base::TimeDelta time, |
62 float value, | 62 float value, |
63 std::unique_ptr<TimingFunction> timing_function); | 63 std::unique_ptr<TimingFunction> timing_function); |
64 ~FloatKeyframe() override; | 64 ~FloatKeyframe() override; |
65 | 65 |
66 float Value() const; | 66 float Value() const; |
67 | 67 |
68 std::unique_ptr<FloatKeyframe> Clone() const; | 68 std::unique_ptr<FloatKeyframe> Clone() const; |
69 | 69 |
70 private: | 70 private: |
71 FloatKeyframe(base::TimeDelta time, | 71 FloatKeyframe(base::TimeDelta time, |
72 float value, | 72 float value, |
73 std::unique_ptr<TimingFunction> timing_function); | 73 std::unique_ptr<TimingFunction> timing_function); |
74 | 74 |
75 float value_; | 75 float value_; |
76 }; | 76 }; |
77 | 77 |
78 class CC_EXPORT TransformKeyframe : public Keyframe { | 78 class CC_ANIMATION_EXPORT TransformKeyframe : public Keyframe { |
79 public: | 79 public: |
80 static std::unique_ptr<TransformKeyframe> Create( | 80 static std::unique_ptr<TransformKeyframe> Create( |
81 base::TimeDelta time, | 81 base::TimeDelta time, |
82 const TransformOperations& value, | 82 const TransformOperations& value, |
83 std::unique_ptr<TimingFunction> timing_function); | 83 std::unique_ptr<TimingFunction> timing_function); |
84 ~TransformKeyframe() override; | 84 ~TransformKeyframe() override; |
85 | 85 |
86 const TransformOperations& Value() const; | 86 const TransformOperations& Value() const; |
87 | 87 |
88 std::unique_ptr<TransformKeyframe> Clone() const; | 88 std::unique_ptr<TransformKeyframe> Clone() const; |
89 | 89 |
90 private: | 90 private: |
91 TransformKeyframe(base::TimeDelta time, | 91 TransformKeyframe(base::TimeDelta time, |
92 const TransformOperations& value, | 92 const TransformOperations& value, |
93 std::unique_ptr<TimingFunction> timing_function); | 93 std::unique_ptr<TimingFunction> timing_function); |
94 | 94 |
95 TransformOperations value_; | 95 TransformOperations value_; |
96 }; | 96 }; |
97 | 97 |
98 class CC_EXPORT FilterKeyframe : public Keyframe { | 98 class CC_ANIMATION_EXPORT FilterKeyframe : public Keyframe { |
99 public: | 99 public: |
100 static std::unique_ptr<FilterKeyframe> Create( | 100 static std::unique_ptr<FilterKeyframe> Create( |
101 base::TimeDelta time, | 101 base::TimeDelta time, |
102 const FilterOperations& value, | 102 const FilterOperations& value, |
103 std::unique_ptr<TimingFunction> timing_function); | 103 std::unique_ptr<TimingFunction> timing_function); |
104 ~FilterKeyframe() override; | 104 ~FilterKeyframe() override; |
105 | 105 |
106 const FilterOperations& Value() const; | 106 const FilterOperations& Value() const; |
107 | 107 |
108 std::unique_ptr<FilterKeyframe> Clone() const; | 108 std::unique_ptr<FilterKeyframe> Clone() const; |
109 | 109 |
110 private: | 110 private: |
111 FilterKeyframe(base::TimeDelta time, | 111 FilterKeyframe(base::TimeDelta time, |
112 const FilterOperations& value, | 112 const FilterOperations& value, |
113 std::unique_ptr<TimingFunction> timing_function); | 113 std::unique_ptr<TimingFunction> timing_function); |
114 | 114 |
115 FilterOperations value_; | 115 FilterOperations value_; |
116 }; | 116 }; |
117 | 117 |
118 class CC_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve { | 118 class CC_ANIMATION_EXPORT KeyframedColorAnimationCurve |
| 119 : public ColorAnimationCurve { |
119 public: | 120 public: |
120 // It is required that the keyframes be sorted by time. | 121 // It is required that the keyframes be sorted by time. |
121 static std::unique_ptr<KeyframedColorAnimationCurve> Create(); | 122 static std::unique_ptr<KeyframedColorAnimationCurve> Create(); |
122 | 123 |
123 ~KeyframedColorAnimationCurve() override; | 124 ~KeyframedColorAnimationCurve() override; |
124 | 125 |
125 void AddKeyframe(std::unique_ptr<ColorKeyframe> keyframe); | 126 void AddKeyframe(std::unique_ptr<ColorKeyframe> keyframe); |
126 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { | 127 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { |
127 timing_function_ = std::move(timing_function); | 128 timing_function_ = std::move(timing_function); |
128 } | 129 } |
(...skipping 14 matching lines...) Expand all Loading... |
143 | 144 |
144 // Always sorted in order of increasing time. No two keyframes have the | 145 // Always sorted in order of increasing time. No two keyframes have the |
145 // same time. | 146 // same time. |
146 std::vector<std::unique_ptr<ColorKeyframe>> keyframes_; | 147 std::vector<std::unique_ptr<ColorKeyframe>> keyframes_; |
147 std::unique_ptr<TimingFunction> timing_function_; | 148 std::unique_ptr<TimingFunction> timing_function_; |
148 double scaled_duration_; | 149 double scaled_duration_; |
149 | 150 |
150 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); | 151 DISALLOW_COPY_AND_ASSIGN(KeyframedColorAnimationCurve); |
151 }; | 152 }; |
152 | 153 |
153 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve { | 154 class CC_ANIMATION_EXPORT KeyframedFloatAnimationCurve |
| 155 : public FloatAnimationCurve { |
154 public: | 156 public: |
155 // It is required that the keyframes be sorted by time. | 157 // It is required that the keyframes be sorted by time. |
156 static std::unique_ptr<KeyframedFloatAnimationCurve> Create(); | 158 static std::unique_ptr<KeyframedFloatAnimationCurve> Create(); |
157 | 159 |
158 ~KeyframedFloatAnimationCurve() override; | 160 ~KeyframedFloatAnimationCurve() override; |
159 | 161 |
160 void AddKeyframe(std::unique_ptr<FloatKeyframe> keyframe); | 162 void AddKeyframe(std::unique_ptr<FloatKeyframe> keyframe); |
161 | 163 |
162 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { | 164 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { |
163 timing_function_ = std::move(timing_function); | 165 timing_function_ = std::move(timing_function); |
(...skipping 21 matching lines...) Expand all Loading... |
185 | 187 |
186 // Always sorted in order of increasing time. No two keyframes have the | 188 // Always sorted in order of increasing time. No two keyframes have the |
187 // same time. | 189 // same time. |
188 Keyframes keyframes_; | 190 Keyframes keyframes_; |
189 std::unique_ptr<TimingFunction> timing_function_; | 191 std::unique_ptr<TimingFunction> timing_function_; |
190 double scaled_duration_; | 192 double scaled_duration_; |
191 | 193 |
192 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); | 194 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve); |
193 }; | 195 }; |
194 | 196 |
195 class CC_EXPORT KeyframedTransformAnimationCurve | 197 class CC_ANIMATION_EXPORT KeyframedTransformAnimationCurve |
196 : public TransformAnimationCurve { | 198 : public TransformAnimationCurve { |
197 public: | 199 public: |
198 // It is required that the keyframes be sorted by time. | 200 // It is required that the keyframes be sorted by time. |
199 static std::unique_ptr<KeyframedTransformAnimationCurve> Create(); | 201 static std::unique_ptr<KeyframedTransformAnimationCurve> Create(); |
200 | 202 |
201 ~KeyframedTransformAnimationCurve() override; | 203 ~KeyframedTransformAnimationCurve() override; |
202 | 204 |
203 void AddKeyframe(std::unique_ptr<TransformKeyframe> keyframe); | 205 void AddKeyframe(std::unique_ptr<TransformKeyframe> keyframe); |
204 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { | 206 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { |
205 timing_function_ = std::move(timing_function); | 207 timing_function_ = std::move(timing_function); |
(...skipping 23 matching lines...) Expand all Loading... |
229 | 231 |
230 // Always sorted in order of increasing time. No two keyframes have the | 232 // Always sorted in order of increasing time. No two keyframes have the |
231 // same time. | 233 // same time. |
232 std::vector<std::unique_ptr<TransformKeyframe>> keyframes_; | 234 std::vector<std::unique_ptr<TransformKeyframe>> keyframes_; |
233 std::unique_ptr<TimingFunction> timing_function_; | 235 std::unique_ptr<TimingFunction> timing_function_; |
234 double scaled_duration_; | 236 double scaled_duration_; |
235 | 237 |
236 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); | 238 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve); |
237 }; | 239 }; |
238 | 240 |
239 class CC_EXPORT KeyframedFilterAnimationCurve | 241 class CC_ANIMATION_EXPORT KeyframedFilterAnimationCurve |
240 : public FilterAnimationCurve { | 242 : public FilterAnimationCurve { |
241 public: | 243 public: |
242 // It is required that the keyframes be sorted by time. | 244 // It is required that the keyframes be sorted by time. |
243 static std::unique_ptr<KeyframedFilterAnimationCurve> Create(); | 245 static std::unique_ptr<KeyframedFilterAnimationCurve> Create(); |
244 | 246 |
245 ~KeyframedFilterAnimationCurve() override; | 247 ~KeyframedFilterAnimationCurve() override; |
246 | 248 |
247 void AddKeyframe(std::unique_ptr<FilterKeyframe> keyframe); | 249 void AddKeyframe(std::unique_ptr<FilterKeyframe> keyframe); |
248 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { | 250 void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { |
249 timing_function_ = std::move(timing_function); | 251 timing_function_ = std::move(timing_function); |
(...skipping 19 matching lines...) Expand all Loading... |
269 std::vector<std::unique_ptr<FilterKeyframe>> keyframes_; | 271 std::vector<std::unique_ptr<FilterKeyframe>> keyframes_; |
270 std::unique_ptr<TimingFunction> timing_function_; | 272 std::unique_ptr<TimingFunction> timing_function_; |
271 double scaled_duration_; | 273 double scaled_duration_; |
272 | 274 |
273 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); | 275 DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); |
274 }; | 276 }; |
275 | 277 |
276 } // namespace cc | 278 } // namespace cc |
277 | 279 |
278 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ | 280 #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_ |
OLD | NEW |