| 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_ANIMATION_ELEMENT_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // LayerAnimationElements represent one segment of an animation between two | 22 // LayerAnimationElements represent one segment of an animation between two |
| 23 // keyframes. They know how to update a LayerAnimationDelegate given a value | 23 // keyframes. They know how to update a LayerAnimationDelegate given a value |
| 24 // between 0 and 1 (0 for initial, and 1 for final). | 24 // between 0 and 1 (0 for initial, and 1 for final). |
| 25 class COMPOSITOR_EXPORT LayerAnimationElement { | 25 class COMPOSITOR_EXPORT LayerAnimationElement { |
| 26 public: | 26 public: |
| 27 enum AnimatableProperty { | 27 enum AnimatableProperty { |
| 28 TRANSFORM = 0, | 28 TRANSFORM = 0, |
| 29 BOUNDS, | 29 BOUNDS, |
| 30 OPACITY, | 30 OPACITY, |
| 31 VISIBILITY | 31 VISIBILITY, |
| 32 BRIGHTNESS, |
| 33 GRAYSCALE |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 struct COMPOSITOR_EXPORT TargetValue { | 36 struct COMPOSITOR_EXPORT TargetValue { |
| 35 TargetValue(); | 37 TargetValue(); |
| 36 // Initializes the target value to match the delegate. NULL may be supplied. | 38 // Initializes the target value to match the delegate. NULL may be supplied. |
| 37 explicit TargetValue(const LayerAnimationDelegate* delegate); | 39 explicit TargetValue(const LayerAnimationDelegate* delegate); |
| 38 | 40 |
| 39 gfx::Rect bounds; | 41 gfx::Rect bounds; |
| 40 Transform transform; | 42 Transform transform; |
| 41 float opacity; | 43 float opacity; |
| 42 bool visibility; | 44 bool visibility; |
| 45 float brightness; |
| 46 float grayscale; |
| 43 }; | 47 }; |
| 44 | 48 |
| 45 typedef std::set<AnimatableProperty> AnimatableProperties; | 49 typedef std::set<AnimatableProperty> AnimatableProperties; |
| 46 | 50 |
| 47 LayerAnimationElement(const AnimatableProperties& properties, | 51 LayerAnimationElement(const AnimatableProperties& properties, |
| 48 base::TimeDelta duration); | 52 base::TimeDelta duration); |
| 49 virtual ~LayerAnimationElement(); | 53 virtual ~LayerAnimationElement(); |
| 50 | 54 |
| 51 // Creates an element that transitions to the given transform. The caller owns | 55 // Creates an element that transitions to the given transform. The caller owns |
| 52 // the return value. | 56 // the return value. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 static LayerAnimationElement* CreateOpacityElement( | 80 static LayerAnimationElement* CreateOpacityElement( |
| 77 float opacity, | 81 float opacity, |
| 78 base::TimeDelta duration); | 82 base::TimeDelta duration); |
| 79 | 83 |
| 80 // Creates an element that sets visibily following a delay. The caller owns | 84 // Creates an element that sets visibily following a delay. The caller owns |
| 81 // the return value. | 85 // the return value. |
| 82 static LayerAnimationElement* CreateVisibilityElement( | 86 static LayerAnimationElement* CreateVisibilityElement( |
| 83 bool visibility, | 87 bool visibility, |
| 84 base::TimeDelta duration); | 88 base::TimeDelta duration); |
| 85 | 89 |
| 90 // Creates an element that transitions to the given brightness. |
| 91 // The caller owns the return value. |
| 92 static LayerAnimationElement* CreateBrightnessElement( |
| 93 float brightness, |
| 94 base::TimeDelta duration); |
| 95 |
| 96 // Creates an element that transitions to the given grayscale value. |
| 97 // The caller owns the return value. |
| 98 static LayerAnimationElement* CreateGrayscaleElement( |
| 99 float grayscale, |
| 100 base::TimeDelta duration); |
| 101 |
| 86 // Creates an element that pauses the given properties. The caller owns the | 102 // Creates an element that pauses the given properties. The caller owns the |
| 87 // return value. | 103 // return value. |
| 88 static LayerAnimationElement* CreatePauseElement( | 104 static LayerAnimationElement* CreatePauseElement( |
| 89 const AnimatableProperties& properties, | 105 const AnimatableProperties& properties, |
| 90 base::TimeDelta duration); | 106 base::TimeDelta duration); |
| 91 | 107 |
| 92 // Updates the delegate to the appropriate value for |t|, which is in the | 108 // Updates the delegate to the appropriate value for |t|, which is in the |
| 93 // range [0, 1] (0 for initial, and 1 for final). If the animation is not | 109 // range [0, 1] (0 for initial, and 1 for final). If the animation is not |
| 94 // aborted, it is guaranteed that Progress will eventually be called with | 110 // aborted, it is guaranteed that Progress will eventually be called with |
| 95 // t = 1.0. Returns true if a redraw is required. | 111 // t = 1.0. Returns true if a redraw is required. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const AnimatableProperties properties_; | 145 const AnimatableProperties properties_; |
| 130 const base::TimeDelta duration_; | 146 const base::TimeDelta duration_; |
| 131 Tween::Type tween_type_; | 147 Tween::Type tween_type_; |
| 132 | 148 |
| 133 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); | 149 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); |
| 134 }; | 150 }; |
| 135 | 151 |
| 136 } // namespace ui | 152 } // namespace ui |
| 137 | 153 |
| 138 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 154 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
| OLD | NEW |