OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 float GetTargetBrightness() const; | 81 float GetTargetBrightness() const; |
82 | 82 |
83 // Sets the grayscale on the delegate. May cause an implicit animation. | 83 // Sets the grayscale on the delegate. May cause an implicit animation. |
84 virtual void SetGrayscale(float grayscale); | 84 virtual void SetGrayscale(float grayscale); |
85 float GetTargetGrayscale() const; | 85 float GetTargetGrayscale() const; |
86 | 86 |
87 // Sets the color on the delegate. May cause an implicit animation. | 87 // Sets the color on the delegate. May cause an implicit animation. |
88 virtual void SetColor(SkColor color); | 88 virtual void SetColor(SkColor color); |
89 SkColor GetTargetColor() const; | 89 SkColor GetTargetColor() const; |
90 | 90 |
91 // Returns the default length of animations, including adjustment for slow | |
92 // animation mode if set. | |
93 base::TimeDelta GetTransitionDuration() const; | |
94 | |
95 // Sets the layer animation delegate the animator is associated with. The | 91 // Sets the layer animation delegate the animator is associated with. The |
96 // animator does not own the delegate. The layer animator expects a non-NULL | 92 // animator does not own the delegate. The layer animator expects a non-NULL |
97 // delegate for most of its operations, so do not call any methods without | 93 // delegate for most of its operations, so do not call any methods without |
98 // a valid delegate installed. | 94 // a valid delegate installed. |
99 void SetDelegate(LayerAnimationDelegate* delegate); | 95 void SetDelegate(LayerAnimationDelegate* delegate); |
100 | 96 |
101 // Sets the animation preemption strategy. This determines the behaviour if | 97 // Sets the animation preemption strategy. This determines the behaviour if |
102 // a property is set during an animation. The default is | 98 // a property is set during an animation. The default is |
103 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). | 99 // IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). |
104 void set_preemption_strategy(PreemptionStrategy strategy) { | 100 void set_preemption_strategy(PreemptionStrategy strategy) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 bool StartSequenceImmediately(LayerAnimationSequence* sequence); | 286 bool StartSequenceImmediately(LayerAnimationSequence* sequence); |
291 | 287 |
292 // Sets the value of target as if all the running and queued animations were | 288 // Sets the value of target as if all the running and queued animations were |
293 // allowed to finish. | 289 // allowed to finish. |
294 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; | 290 void GetTargetValue(LayerAnimationElement::TargetValue* target) const; |
295 | 291 |
296 // Called whenever an animation is added to the animation queue. Either by | 292 // Called whenever an animation is added to the animation queue. Either by |
297 // starting the animation or adding to the queue. | 293 // starting the animation or adding to the queue. |
298 void OnScheduled(LayerAnimationSequence* sequence); | 294 void OnScheduled(LayerAnimationSequence* sequence); |
299 | 295 |
300 // Sets |transition_duration_| unless |is_transition_duration_locked_| is set. | 296 // Returns the default length of animations, including adjustment for slow |
| 297 // animation mode if set. |
| 298 base::TimeDelta GetTransitionDuration() const; |
| 299 |
| 300 // Sets |transition_duration_|. |
301 void SetTransitionDuration(base::TimeDelta duration); | 301 void SetTransitionDuration(base::TimeDelta duration); |
302 | 302 |
303 // Clears the animation queues and notifies any running animations that they | 303 // Clears the animation queues and notifies any running animations that they |
304 // have been aborted. | 304 // have been aborted. |
305 void ClearAnimationsInternal(); | 305 void ClearAnimationsInternal(); |
306 | 306 |
307 // Cleans up any running animations that may have been deleted. | 307 // Cleans up any running animations that may have been deleted. |
308 void PurgeDeletedAnimations(); | 308 void PurgeDeletedAnimations(); |
309 | 309 |
310 // This is the queue of animations to run. | 310 // This is the queue of animations to run. |
311 AnimationQueue animation_queue_; | 311 AnimationQueue animation_queue_; |
312 | 312 |
313 // The target of all layer animations. | 313 // The target of all layer animations. |
314 LayerAnimationDelegate* delegate_; | 314 LayerAnimationDelegate* delegate_; |
315 | 315 |
316 // The currently running animations. | 316 // The currently running animations. |
317 RunningAnimations running_animations_; | 317 RunningAnimations running_animations_; |
318 | 318 |
319 // Determines how animations are replaced. | 319 // Determines how animations are replaced. |
320 PreemptionStrategy preemption_strategy_; | 320 PreemptionStrategy preemption_strategy_; |
321 | 321 |
322 // Whether the length of animations is locked. While it is locked | |
323 // SetTransitionDuration does not set |transition_duration_|. | |
324 bool is_transition_duration_locked_; | |
325 | |
326 // The default length of animations. | 322 // The default length of animations. |
327 base::TimeDelta transition_duration_; | 323 base::TimeDelta transition_duration_; |
328 | 324 |
329 // The default tween type for implicit transitions | 325 // The default tween type for implicit transitions |
330 gfx::Tween::Type tween_type_; | 326 gfx::Tween::Type tween_type_; |
331 | 327 |
332 // Used for coordinating the starting of animations. | 328 // Used for coordinating the starting of animations. |
333 base::TimeTicks last_step_time_; | 329 base::TimeTicks last_step_time_; |
334 | 330 |
335 // True if we are being stepped by our container. | 331 // True if we are being stepped by our container. |
(...skipping 10 matching lines...) Expand all Loading... |
346 // Observers are notified when layer animations end, are scheduled or are | 342 // Observers are notified when layer animations end, are scheduled or are |
347 // aborted. | 343 // aborted. |
348 ObserverList<LayerAnimationObserver> observers_; | 344 ObserverList<LayerAnimationObserver> observers_; |
349 | 345 |
350 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 346 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
351 }; | 347 }; |
352 | 348 |
353 } // namespace ui | 349 } // namespace ui |
354 | 350 |
355 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 351 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
OLD | NEW |