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 #ifndef UI_GFX_ANIMATION_TWEEN_H_ | 5 #ifndef UI_GFX_ANIMATION_TWEEN_H_ |
6 #define UI_GFX_ANIMATION_TWEEN_H_ | 6 #define UI_GFX_ANIMATION_TWEEN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/transform.h" | 12 #include "ui/gfx/transform.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 class GFX_EXPORT Tween { | 16 class GFX_EXPORT Tween { |
17 public: | 17 public: |
18 enum Type { | 18 enum Type { |
19 LINEAR, // Linear. | 19 LINEAR, // Linear. |
20 EASE_OUT, // Fast in, slow out (default). | 20 EASE_OUT, // Fast in, slow out (default). |
21 EASE_IN, // Slow in, fast out. | 21 EASE_OUT_BEZIER, // Variant of EASE_OUT that starts and ends slower. |
22 EASE_IN_2, // Variant of EASE_IN that starts out slower. | 22 EASE_IN, // Slow in, fast out. |
23 EASE_IN_OUT, // Slow in and out, fast in the middle. | 23 EASE_IN_2, // Variant of EASE_IN that starts out slower. |
24 FAST_IN_OUT, // Fast in and out, slow in the middle. | 24 EASE_IN_BEZIER, // Variant of EASE_IN that starts slower than EASE_IN and |
25 EASE_OUT_SNAP, // Fast in, slow out, snap to final value. | 25 // ends faster than both EASE_IN and EASE_IN_2 |
26 SMOOTH_IN_OUT, // Smooth, consistent speeds in and out (sine wave). | 26 EASE_IN_OUT, // Slow in and out, fast in the middle. |
27 ZERO, // Returns a value of 0 always. | 27 FAST_IN_OUT, // Fast in and out, slow in the middle. |
| 28 EASE_OUT_SNAP, // Fast in, slow out, snap to final value. |
| 29 SMOOTH_IN_OUT, // Smooth, consistent speeds in and out (sine wave). |
| 30 ZERO, // Returns a value of 0 always. |
28 }; | 31 }; |
29 | 32 |
30 // Returns the value based on the tween type. |state| is from 0-1. | 33 // Returns the value based on the tween type. |state| is from 0-1. |
31 static double CalculateValue(Type type, double state); | 34 static double CalculateValue(Type type, double state); |
32 | 35 |
33 // Conveniences for getting a value between a start and end point. | 36 // Conveniences for getting a value between a start and end point. |
34 static SkColor ColorValueBetween(double value, SkColor start, SkColor target); | 37 static SkColor ColorValueBetween(double value, SkColor start, SkColor target); |
35 static double DoubleValueBetween(double value, double start, double target); | 38 static double DoubleValueBetween(double value, double start, double target); |
36 static float FloatValueBetween(double value, float start, float target); | 39 static float FloatValueBetween(double value, float start, float target); |
37 | 40 |
(...skipping 18 matching lines...) Expand all Loading... |
56 private: | 59 private: |
57 Tween(); | 60 Tween(); |
58 ~Tween(); | 61 ~Tween(); |
59 | 62 |
60 DISALLOW_COPY_AND_ASSIGN(Tween); | 63 DISALLOW_COPY_AND_ASSIGN(Tween); |
61 }; | 64 }; |
62 | 65 |
63 } // namespace gfx | 66 } // namespace gfx |
64 | 67 |
65 #endif // UI_GFX_ANIMATION_TWEEN_H_ | 68 #endif // UI_GFX_ANIMATION_TWEEN_H_ |
OLD | NEW |