Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: cc/animation/animation.h

Issue 1700653002: CC Animation: Expose TargetProperty enum to be aliased in Blink Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/BUILD.gn ('k') | cc/animation/animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ANIMATION_H_ 5 #ifndef CC_ANIMATION_ANIMATION_H_
6 #define CC_ANIMATION_ANIMATION_H_ 6 #define CC_ANIMATION_ANIMATION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "cc/animation/target_property.h"
11 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
12 13
13 namespace cc { 14 namespace cc {
14 15
15 class AnimationCurve; 16 class AnimationCurve;
16 17
17 // An Animation contains all the state required to play an AnimationCurve. 18 // An Animation contains all the state required to play an AnimationCurve.
18 // Specifically, the affected property, the run state (paused, finished, etc.), 19 // Specifically, the affected property, the run state (paused, finished, etc.),
19 // loop count, last pause time, and the total time spent paused. 20 // loop count, last pause time, and the total time spent paused.
20 class CC_EXPORT Animation { 21 class CC_EXPORT Animation {
(...skipping 11 matching lines...) Expand all
32 WAITING_FOR_DELETION, 33 WAITING_FOR_DELETION,
33 STARTING, 34 STARTING,
34 RUNNING, 35 RUNNING,
35 PAUSED, 36 PAUSED,
36 FINISHED, 37 FINISHED,
37 ABORTED, 38 ABORTED,
38 // This sentinel must be last. 39 // This sentinel must be last.
39 LAST_RUN_STATE = ABORTED 40 LAST_RUN_STATE = ABORTED
40 }; 41 };
41 42
42 enum TargetProperty {
43 TRANSFORM = 0,
44 OPACITY,
45 FILTER,
46 SCROLL_OFFSET,
47 BACKGROUND_COLOR,
48 // This sentinel must be last.
49 LAST_TARGET_PROPERTY = BACKGROUND_COLOR
50 };
51
52 enum Direction { 43 enum Direction {
53 DIRECTION_NORMAL, 44 DIRECTION_NORMAL,
54 DIRECTION_REVERSE, 45 DIRECTION_REVERSE,
55 DIRECTION_ALTERNATE, 46 DIRECTION_ALTERNATE,
56 DIRECTION_ALTERNATE_REVERSE 47 DIRECTION_ALTERNATE_REVERSE
57 }; 48 };
58 49
59 enum FillMode { 50 enum FillMode {
60 FILL_MODE_NONE, 51 FILL_MODE_NONE,
61 FILL_MODE_FORWARDS, 52 FILL_MODE_FORWARDS,
62 FILL_MODE_BACKWARDS, 53 FILL_MODE_BACKWARDS,
63 FILL_MODE_BOTH 54 FILL_MODE_BOTH
64 }; 55 };
65 56
66 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve, 57 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve,
67 int animation_id, 58 int animation_id,
68 int group_id, 59 int group_id,
69 TargetProperty target_property); 60 TargetProperty::Type target_property);
70 61
71 virtual ~Animation(); 62 virtual ~Animation();
72 63
73 int id() const { return id_; } 64 int id() const { return id_; }
74 int group() const { return group_; } 65 int group() const { return group_; }
75 TargetProperty target_property() const { return target_property_; } 66 TargetProperty::Type target_property() const { return target_property_; }
76 67
77 RunState run_state() const { return run_state_; } 68 RunState run_state() const { return run_state_; }
78 void SetRunState(RunState run_state, base::TimeTicks monotonic_time); 69 void SetRunState(RunState run_state, base::TimeTicks monotonic_time);
79 70
80 // This is the number of times that the animation will play. If this 71 // This is the number of times that the animation will play. If this
81 // value is zero the animation will not play. If it is negative, then 72 // value is zero the animation will not play. If it is negative, then
82 // the animation will loop indefinitely. 73 // the animation will loop indefinitely.
83 double iterations() const { return iterations_; } 74 double iterations() const { return iterations_; }
84 void set_iterations(double n) { iterations_ = n; } 75 void set_iterations(double n) { iterations_ = n; }
85 76
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 159
169 void set_affects_pending_observers(bool affects_pending_observers) { 160 void set_affects_pending_observers(bool affects_pending_observers) {
170 affects_pending_observers_ = affects_pending_observers; 161 affects_pending_observers_ = affects_pending_observers;
171 } 162 }
172 bool affects_pending_observers() const { return affects_pending_observers_; } 163 bool affects_pending_observers() const { return affects_pending_observers_; }
173 164
174 private: 165 private:
175 Animation(scoped_ptr<AnimationCurve> curve, 166 Animation(scoped_ptr<AnimationCurve> curve,
176 int animation_id, 167 int animation_id,
177 int group_id, 168 int group_id,
178 TargetProperty target_property); 169 TargetProperty::Type target_property);
179 170
180 base::TimeDelta ConvertToActiveTime(base::TimeTicks monotonic_time) const; 171 base::TimeDelta ConvertToActiveTime(base::TimeTicks monotonic_time) const;
181 172
182 scoped_ptr<AnimationCurve> curve_; 173 scoped_ptr<AnimationCurve> curve_;
183 174
184 // IDs must be unique. 175 // IDs must be unique.
185 int id_; 176 int id_;
186 177
187 // Animations that must be run together are called 'grouped' and have the same 178 // Animations that must be run together are called 'grouped' and have the same
188 // group id. Grouped animations are guaranteed to start at the same time and 179 // group id. Grouped animations are guaranteed to start at the same time and
189 // no other animations may animate any of the group's target properties until 180 // no other animations may animate any of the group's target properties until
190 // all animations in the group have finished animating. 181 // all animations in the group have finished animating.
191 int group_; 182 int group_;
192 183
193 TargetProperty target_property_; 184 TargetProperty::Type target_property_;
194 RunState run_state_; 185 RunState run_state_;
195 double iterations_; 186 double iterations_;
196 double iteration_start_; 187 double iteration_start_;
197 base::TimeTicks start_time_; 188 base::TimeTicks start_time_;
198 Direction direction_; 189 Direction direction_;
199 double playback_rate_; 190 double playback_rate_;
200 FillMode fill_mode_; 191 FillMode fill_mode_;
201 192
202 // The time offset effectively pushes the start of the animation back in time. 193 // The time offset effectively pushes the start of the animation back in time.
203 // This is used for resuming paused animations -- an animation is added with a 194 // This is used for resuming paused animations -- an animation is added with a
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // longer affect any observers, and are deleted. 235 // longer affect any observers, and are deleted.
245 bool affects_active_observers_; 236 bool affects_active_observers_;
246 bool affects_pending_observers_; 237 bool affects_pending_observers_;
247 238
248 DISALLOW_COPY_AND_ASSIGN(Animation); 239 DISALLOW_COPY_AND_ASSIGN(Animation);
249 }; 240 };
250 241
251 } // namespace cc 242 } // namespace cc
252 243
253 #endif // CC_ANIMATION_ANIMATION_H_ 244 #endif // CC_ANIMATION_ANIMATION_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/animation/animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698