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/tween.h" | 5 #include "ui/base/animation/tween.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <float.h> | 10 #include <float.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "gfx/rect.h" | 14 #include "gfx/rect.h" |
15 | 15 |
| 16 namespace ui { |
| 17 |
16 // static | 18 // static |
17 double Tween::CalculateValue(Tween::Type type, double state) { | 19 double Tween::CalculateValue(Tween::Type type, double state) { |
18 DCHECK_GE(state, 0); | 20 DCHECK_GE(state, 0); |
19 DCHECK_LE(state, 1); | 21 DCHECK_LE(state, 1); |
20 | 22 |
21 switch (type) { | 23 switch (type) { |
22 case EASE_IN: | 24 case EASE_IN: |
23 return pow(state, 2); | 25 return pow(state, 2); |
24 | 26 |
25 case EASE_IN_OUT: | 27 case EASE_IN_OUT: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 gfx::Rect Tween::ValueBetween(double value, | 75 gfx::Rect Tween::ValueBetween(double value, |
74 const gfx::Rect& start_bounds, | 76 const gfx::Rect& start_bounds, |
75 const gfx::Rect& target_bounds) { | 77 const gfx::Rect& target_bounds) { |
76 return gfx::Rect(ValueBetween(value, start_bounds.x(), target_bounds.x()), | 78 return gfx::Rect(ValueBetween(value, start_bounds.x(), target_bounds.x()), |
77 ValueBetween(value, start_bounds.y(), target_bounds.y()), | 79 ValueBetween(value, start_bounds.y(), target_bounds.y()), |
78 ValueBetween(value, start_bounds.width(), | 80 ValueBetween(value, start_bounds.width(), |
79 target_bounds.width()), | 81 target_bounds.width()), |
80 ValueBetween(value, start_bounds.height(), | 82 ValueBetween(value, start_bounds.height(), |
81 target_bounds.height())); | 83 target_bounds.height())); |
82 } | 84 } |
| 85 |
| 86 } // namespace ui |
OLD | NEW |