| OLD | NEW |
| 1 // Copyright (c) 2010 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 "app/slide_animation.h" | 5 #include "ui/base/animation/slide_animation.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 namespace ui { |
| 10 |
| 9 // How many frames per second to target. | 11 // How many frames per second to target. |
| 10 static const int kDefaultFramerateHz = 50; | 12 static const int kDefaultFramerateHz = 50; |
| 11 | 13 |
| 12 // How long animations should take by default. | 14 // How long animations should take by default. |
| 13 static const int kDefaultDurationMs = 120; | 15 static const int kDefaultDurationMs = 120; |
| 14 | 16 |
| 15 SlideAnimation::SlideAnimation(AnimationDelegate* target) | 17 SlideAnimation::SlideAnimation(AnimationDelegate* target) |
| 16 : LinearAnimation(kDefaultFramerateHz, target), | 18 : LinearAnimation(kDefaultFramerateHz, target), |
| 17 target_(target), | 19 target_(target), |
| 18 tween_type_(Tween::EASE_OUT), | 20 tween_type_(Tween::EASE_OUT), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 fabs(value_current_ - value_end_) <= 0.06) | 103 fabs(value_current_ - value_end_) <= 0.06) |
| 102 value_current_ = value_end_; | 104 value_current_ = value_end_; |
| 103 | 105 |
| 104 // 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 |
| 105 // take any rounding error chances. | 107 // take any rounding error chances. |
| 106 if ((value_end_ >= value_start_ && value_current_ > value_end_) || | 108 if ((value_end_ >= value_start_ && value_current_ > value_end_) || |
| 107 (value_end_ < value_start_ && value_current_ < value_end_)) { | 109 (value_end_ < value_start_ && value_current_ < value_end_)) { |
| 108 value_current_ = value_end_; | 110 value_current_ = value_end_; |
| 109 } | 111 } |
| 110 } | 112 } |
| 113 |
| 114 } // namespace ui |
| OLD | NEW |