OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/slide_animation.h" | 5 #include "chrome/common/slide_animation.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 // How many frames per second to target. | 9 // How many frames per second to target. |
10 static const int kDefaultFramerateHz = 50; | 10 static const int kDefaultFramerateHz = 50; |
11 | 11 |
12 // How long animations should take by default. | 12 // How long animations should take by default. |
13 static const int kDefaultDurationMs = 120; | 13 static const int kDefaultDurationMs = 120; |
14 | 14 |
15 SlideAnimation::SlideAnimation(AnimationDelegate* target) | 15 SlideAnimation::SlideAnimation(AnimationDelegate* target) |
16 : Animation(kDefaultFramerateHz, target), | 16 : Animation(kDefaultFramerateHz, target), |
17 target_(target), | 17 target_(target), |
| 18 tween_type_(EASE_OUT), |
18 showing_(false), | 19 showing_(false), |
19 value_start_(0), | 20 value_start_(0), |
20 value_end_(0), | 21 value_end_(0), |
21 value_current_(0), | 22 value_current_(0), |
22 tween_type_(EASE_OUT), | |
23 slide_duration_(kDefaultDurationMs) { | 23 slide_duration_(kDefaultDurationMs) { |
24 } | 24 } |
25 | 25 |
26 SlideAnimation::~SlideAnimation() { | 26 SlideAnimation::~SlideAnimation() { |
27 } | 27 } |
28 | 28 |
29 void SlideAnimation::Reset() { | 29 void SlideAnimation::Reset() { |
30 Reset(0); | 30 Reset(0); |
31 } | 31 } |
32 | 32 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 value_current_ = value_end_; | 117 value_current_ = value_end_; |
118 | 118 |
119 // Correct for any overshoot (while state may be capped at 1.0, let's not | 119 // Correct for any overshoot (while state may be capped at 1.0, let's not |
120 // take any rounding error chances. | 120 // take any rounding error chances. |
121 if ((value_end_ >= value_start_ && value_current_ > value_end_) || | 121 if ((value_end_ >= value_start_ && value_current_ > value_end_) || |
122 (value_end_ < value_start_ && value_current_ < value_end_)) { | 122 (value_end_ < value_start_ && value_current_ < value_end_)) { |
123 value_current_ = value_end_; | 123 value_current_ = value_end_; |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
OLD | NEW |