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

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

Issue 180153010: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « no previous file | cc/animation/animation.cc » ('j') | cc/animation/animation.cc » ('J')
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/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
(...skipping 30 matching lines...) Expand all
41 enum TargetProperty { 41 enum TargetProperty {
42 Transform = 0, 42 Transform = 0,
43 Opacity, 43 Opacity,
44 Filter, 44 Filter,
45 ScrollOffset, 45 ScrollOffset,
46 BackgroundColor, 46 BackgroundColor,
47 // This sentinel must be last. 47 // This sentinel must be last.
48 TargetPropertyEnumSize 48 TargetPropertyEnumSize
49 }; 49 };
50 50
51 enum Direction {
52 Normal = 0,
53 Reverse,
54 Alternate,
55 AlternateReverse
56 };
57
51 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve, 58 static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve,
52 int animation_id, 59 int animation_id,
53 int group_id, 60 int group_id,
54 TargetProperty target_property); 61 TargetProperty target_property);
55 62
56 virtual ~Animation(); 63 virtual ~Animation();
57 64
58 int id() const { return id_; } 65 int id() const { return id_; }
59 int group() const { return group_; } 66 int group() const { return group_; }
60 TargetProperty target_property() const { return target_property_; } 67 TargetProperty target_property() const { return target_property_; }
(...skipping 10 matching lines...) Expand all
71 double start_time() const { return start_time_; } 78 double start_time() const { return start_time_; }
72 void set_start_time(double monotonic_time) { start_time_ = monotonic_time; } 79 void set_start_time(double monotonic_time) { start_time_ = monotonic_time; }
73 bool has_set_start_time() const { return !!start_time_; } 80 bool has_set_start_time() const { return !!start_time_; }
74 81
75 double time_offset() const { return time_offset_; } 82 double time_offset() const { return time_offset_; }
76 void set_time_offset(double monotonic_time) { time_offset_ = monotonic_time; } 83 void set_time_offset(double monotonic_time) { time_offset_ = monotonic_time; }
77 84
78 void Suspend(double monotonic_time); 85 void Suspend(double monotonic_time);
79 void Resume(double monotonic_time); 86 void Resume(double monotonic_time);
80 87
81 // If alternates_direction is true, on odd numbered iterations we reverse the 88 Direction direction() { return direction_; }
82 // curve. 89 void set_direction(Direction direction) {
83 bool alternates_direction() const { return alternates_direction_; } 90 direction_ = direction;
84 void set_alternates_direction(bool alternates) {
85 alternates_direction_ = alternates;
86 } 91 }
87 92
88 bool IsFinishedAt(double monotonic_time) const; 93 bool IsFinishedAt(double monotonic_time) const;
89 bool is_finished() const { 94 bool is_finished() const {
90 return run_state_ == Finished || 95 return run_state_ == Finished ||
91 run_state_ == Aborted || 96 run_state_ == Aborted ||
92 run_state_ == WaitingForDeletion; 97 run_state_ == WaitingForDeletion;
93 } 98 }
94 99
95 AnimationCurve* curve() { return curve_.get(); } 100 AnimationCurve* curve() { return curve_.get(); }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // group id. Grouped animations are guaranteed to start at the same time and 148 // group id. Grouped animations are guaranteed to start at the same time and
144 // no other animations may animate any of the group's target properties until 149 // no other animations may animate any of the group's target properties until
145 // all animations in the group have finished animating. Note: an active 150 // all animations in the group have finished animating. Note: an active
146 // animation's group id and target property uniquely identify that animation. 151 // animation's group id and target property uniquely identify that animation.
147 int group_; 152 int group_;
148 153
149 TargetProperty target_property_; 154 TargetProperty target_property_;
150 RunState run_state_; 155 RunState run_state_;
151 int iterations_; 156 int iterations_;
152 double start_time_; 157 double start_time_;
153 bool alternates_direction_; 158 Direction direction_;
154 159
155 // The time offset effectively pushes the start of the animation back in time. 160 // The time offset effectively pushes the start of the animation back in time.
156 // This is used for resuming paused animations -- an animation is added with a 161 // This is used for resuming paused animations -- an animation is added with a
157 // non-zero time offset, causing the animation to skip ahead to the desired 162 // non-zero time offset, causing the animation to skip ahead to the desired
158 // point in time. 163 // point in time.
159 double time_offset_; 164 double time_offset_;
160 165
161 bool needs_synchronized_start_time_; 166 bool needs_synchronized_start_time_;
162 bool received_finished_event_; 167 bool received_finished_event_;
163 168
(...skipping 19 matching lines...) Expand all
183 bool is_controlling_instance_; 188 bool is_controlling_instance_;
184 189
185 bool is_impl_only_; 190 bool is_impl_only_;
186 191
187 DISALLOW_COPY_AND_ASSIGN(Animation); 192 DISALLOW_COPY_AND_ASSIGN(Animation);
188 }; 193 };
189 194
190 } // namespace cc 195 } // namespace cc
191 196
192 #endif // CC_ANIMATION_ANIMATION_H_ 197 #endif // CC_ANIMATION_ANIMATION_H_
OLDNEW
« no previous file with comments | « no previous file | cc/animation/animation.cc » ('j') | cc/animation/animation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698