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

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

Issue 2679333002: [ash-md] Remove the number of animators used for the Shelf animations. (Closed)
Patch Set: Addressed comments from patch set 4. Created 3 years, 10 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
« no previous file with comments | « ui/gfx/animation/slide_animation.h ('k') | ui/gfx/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) 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/gfx/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 gfx { 9 namespace gfx {
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // If we're already hiding (or hidden), we have nothing to do. 60 // If we're already hiding (or hidden), we have nothing to do.
61 if (!showing_) 61 if (!showing_)
62 return; 62 return;
63 63
64 showing_ = false; 64 showing_ = false;
65 value_start_ = value_current_; 65 value_start_ = value_current_;
66 value_end_ = 0.0; 66 value_end_ = 0.0;
67 67
68 // Make sure we actually have something to do. 68 // Make sure we actually have something to do.
69 if (slide_duration_ == 0) { 69 if (slide_duration_ == 0) {
70 // TODO(bruthig): Investigate if this should really be animating to 0.0, I
71 // think it should be animating to 1.0.
70 AnimateToState(0.0); // Skip to the end of the animation. 72 AnimateToState(0.0); // Skip to the end of the animation.
71 return; 73 return;
72 } else if (value_current_ == value_end_) { 74 } else if (value_current_ == value_end_) {
73 return; 75 return;
74 } 76 }
75 77
76 // This will also reset the currently-occurring animation. 78 // This will also reset the currently-occurring animation.
77 SetDuration(static_cast<int>(slide_duration_ * value_current_)); 79 SetDuration(static_cast<int>(slide_duration_ * value_current_));
78 Start(); 80 Start();
79 } 81 }
(...skipping 21 matching lines...) Expand all
101 103
102 // Correct for any overshoot (while state may be capped at 1.0, let's not 104 // Correct for any overshoot (while state may be capped at 1.0, let's not
103 // take any rounding error chances. 105 // take any rounding error chances.
104 if ((value_end_ >= value_start_ && value_current_ > value_end_) || 106 if ((value_end_ >= value_start_ && value_current_ > value_end_) ||
105 (value_end_ < value_start_ && value_current_ < value_end_)) { 107 (value_end_ < value_start_ && value_current_ < value_end_)) {
106 value_current_ = value_end_; 108 value_current_ = value_end_;
107 } 109 }
108 } 110 }
109 111
110 } // namespace gfx 112 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/animation/slide_animation.h ('k') | ui/gfx/animation/slide_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698