OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/compositor/layer_animation_element.h" | 5 #include "ui/gfx/compositor/layer_animation_element.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "ui/base/animation/tween.h" | 8 #include "ui/base/animation/tween.h" |
9 #include "ui/gfx/compositor/layer_animation_delegate.h" | 9 #include "ui/gfx/compositor/layer_animation_delegate.h" |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 gfx::Rect start_; | 106 gfx::Rect start_; |
107 const gfx::Rect target_; | 107 const gfx::Rect target_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(BoundsTransition); | 109 DISALLOW_COPY_AND_ASSIGN(BoundsTransition); |
110 }; | 110 }; |
111 | 111 |
112 class OpacityTransition : public LayerAnimationElement { | 112 class OpacityTransition : public LayerAnimationElement { |
113 public: | 113 public: |
114 OpacityTransition(float target, base::TimeDelta duration) | 114 OpacityTransition(float target, base::TimeDelta duration) |
115 : LayerAnimationElement(GetProperties(), duration), | 115 : LayerAnimationElement(GetProperties(), duration), |
| 116 start_(0.0f), |
116 target_(target) { | 117 target_(target) { |
117 } | 118 } |
118 virtual ~OpacityTransition() {} | 119 virtual ~OpacityTransition() {} |
119 | 120 |
120 protected: | 121 protected: |
121 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { | 122 virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { |
122 start_ = delegate->GetOpacityForAnimation(); | 123 start_ = delegate->GetOpacityForAnimation(); |
123 } | 124 } |
124 | 125 |
125 virtual void OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { | 126 virtual void OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return new OpacityTransition(opacity, duration); | 211 return new OpacityTransition(opacity, duration); |
211 } | 212 } |
212 | 213 |
213 // static | 214 // static |
214 LayerAnimationElement* LayerAnimationElement::CreatePauseElement( | 215 LayerAnimationElement* LayerAnimationElement::CreatePauseElement( |
215 const AnimatableProperties& properties, base::TimeDelta duration) { | 216 const AnimatableProperties& properties, base::TimeDelta duration) { |
216 return new Pause(properties, duration); | 217 return new Pause(properties, duration); |
217 } | 218 } |
218 | 219 |
219 } // namespace ui | 220 } // namespace ui |
OLD | NEW |