Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: ui/base/animation/slide_animation.cc

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/animation/slide_animation.h ('k') | ui/base/animation/slide_animation_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/base/animation/slide_animation.h ('k') | ui/base/animation/slide_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698