OLD | NEW |
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/base/animation/tween.h" | 5 #include "ui/gfx/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 | 14 |
15 namespace ui { | 15 namespace gfx { |
16 | 16 |
17 // static | 17 // static |
18 double Tween::CalculateValue(Tween::Type type, double state) { | 18 double Tween::CalculateValue(Tween::Type type, double state) { |
19 DCHECK_GE(state, 0); | 19 DCHECK_GE(state, 0); |
20 DCHECK_LE(state, 1); | 20 DCHECK_LE(state, 1); |
21 | 21 |
22 switch (type) { | 22 switch (type) { |
23 case EASE_IN: | 23 case EASE_IN: |
24 return pow(state, 2); | 24 return pow(state, 2); |
25 | 25 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return end_transform; | 96 return end_transform; |
97 if (value <= 0.0) | 97 if (value <= 0.0) |
98 return start_transform; | 98 return start_transform; |
99 | 99 |
100 gfx::Transform to_return = end_transform; | 100 gfx::Transform to_return = end_transform; |
101 to_return.Blend(start_transform, value); | 101 to_return.Blend(start_transform, value); |
102 | 102 |
103 return to_return; | 103 return to_return; |
104 } | 104 } |
105 | 105 |
106 } // namespace ui | 106 } // namespace gfx |
OLD | NEW |