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 #include "ui/base/animation/slide_animation.h" | 5 #include "ui/gfx/animation/slide_animation.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 namespace ui { | 9 namespace gfx { |
10 | 10 |
11 // How many frames per second to target. | 11 // How many frames per second to target. |
12 static const int kDefaultFrameRateHz = 60; | 12 static const int kDefaultFrameRateHz = 60; |
13 | 13 |
14 // How long animations should take by default. | 14 // How long animations should take by default. |
15 static const int kDefaultDurationMs = 120; | 15 static const int kDefaultDurationMs = 120; |
16 | 16 |
17 SlideAnimation::SlideAnimation(AnimationDelegate* target) | 17 SlideAnimation::SlideAnimation(AnimationDelegate* target) |
18 : LinearAnimation(kDefaultFrameRateHz, target), | 18 : LinearAnimation(kDefaultFrameRateHz, target), |
19 target_(target), | 19 target_(target), |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 value_current_ = value_end_; | 104 value_current_ = value_end_; |
105 | 105 |
106 // Correct for any overshoot (while state may be capped at 1.0, let's not | 106 // Correct for any overshoot (while state may be capped at 1.0, let's not |
107 // take any rounding error chances. | 107 // take any rounding error chances. |
108 if ((value_end_ >= value_start_ && value_current_ > value_end_) || | 108 if ((value_end_ >= value_start_ && value_current_ > value_end_) || |
109 (value_end_ < value_start_ && value_current_ < value_end_)) { | 109 (value_end_ < value_start_ && value_current_ < value_end_)) { |
110 value_current_ = value_end_; | 110 value_current_ = value_end_; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 } // namespace ui | 114 } // namespace gfx |
OLD | NEW |