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/macros.h" | 8 #include "base/macros.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/gfx/animation/animation_export.h" | 10 #include "ui/gfx/animation/animation_export.h" |
11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/transform.h" | 12 #include "ui/gfx/transform.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class TimeTicks; | 15 class TimeTicks; |
16 } | 16 } |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 | 19 |
20 class ANIMATION_EXPORT Tween { | 20 class ANIMATION_EXPORT Tween { |
21 public: | 21 public: |
22 enum Type { | 22 enum Type { |
23 LINEAR, // Linear. | 23 LINEAR, // Linear. |
24 EASE_OUT, // Fast in, slow out (default). | 24 EASE_OUT, // Fast in, slow out (default). |
25 EASE_IN, // Slow in, fast out. | 25 EASE_IN, // Slow in, fast out. |
26 EASE_IN_2, // Variant of EASE_IN that starts out slower than | 26 EASE_IN_2, // Variant of EASE_IN that starts out slower than |
27 // EASE_IN. | 27 // EASE_IN. |
28 EASE_IN_OUT, // Slow in and out, fast in the middle. | 28 EASE_IN_OUT, // Slow in and out, fast in the middle. |
29 FAST_IN_OUT, // Fast in and out, slow in the middle. | 29 FAST_IN_OUT, // Fast in and out, slow in the middle. |
30 EASE_OUT_SNAP, // Fast in, slow out, snap to final value. | 30 EASE_OUT_SNAP, // Fast in, slow out, snap to final value. |
31 SMOOTH_IN_OUT, // Smooth, consistent speeds in and out (sine wave). | 31 SMOOTH_IN_OUT, // Smooth, consistent speeds in and out (sine wave). |
32 FAST_OUT_SLOW_IN, // Variant of EASE_IN_OUT which should be used in most | 32 FAST_OUT_SLOW_IN, // Variant of EASE_IN_OUT which should be used in most |
33 // cases. | 33 // cases. |
34 LINEAR_OUT_SLOW_IN, // Variant of EASE_OUT which should be used for | 34 LINEAR_OUT_SLOW_IN, // Variant of EASE_OUT which should be used for |
xc
2017/06/21 20:41:32
git cl format updated all these white spaces. Let
| |
35 // fading in from 0% or motion when entering a scene. | 35 // fading in from 0% or motion when entering a scene. |
36 FAST_OUT_LINEAR_IN, // Variant of EASE_IN which should should be used for | 36 SLOW_OUT_LINEAR_IN, // Reverse of LINEAR_OUT_SLOW_IN which should be used |
37 // fading out to 0% or motion when exiting a scene. | 37 // in reverse animation to create a rubberband effect. |
38 ZERO, // Returns a value of 0 always. | 38 FAST_OUT_LINEAR_IN, // Variant of EASE_IN which should should be used for |
39 // fading out to 0% or motion when exiting a scene. | |
40 ZERO, // Returns a value of 0 always. | |
39 }; | 41 }; |
40 | 42 |
41 // Returns the value based on the tween type. |state| is from 0-1. | 43 // Returns the value based on the tween type. |state| is from 0-1. |
42 static double CalculateValue(Type type, double state); | 44 static double CalculateValue(Type type, double state); |
43 | 45 |
44 // Conveniences for getting a value between a start and end point. | 46 // Conveniences for getting a value between a start and end point. |
45 static SkColor ColorValueBetween(double value, SkColor start, SkColor target); | 47 static SkColor ColorValueBetween(double value, SkColor start, SkColor target); |
46 static double DoubleValueBetween(double value, double start, double target); | 48 static double DoubleValueBetween(double value, double start, double target); |
47 static float FloatValueBetween(double value, float start, float target); | 49 static float FloatValueBetween(double value, float start, float target); |
48 static float ClampedFloatValueBetween(const base::TimeTicks& time, | 50 static float ClampedFloatValueBetween(const base::TimeTicks& time, |
(...skipping 23 matching lines...) Expand all Loading... | |
72 private: | 74 private: |
73 Tween(); | 75 Tween(); |
74 ~Tween(); | 76 ~Tween(); |
75 | 77 |
76 DISALLOW_COPY_AND_ASSIGN(Tween); | 78 DISALLOW_COPY_AND_ASSIGN(Tween); |
77 }; | 79 }; |
78 | 80 |
79 } // namespace gfx | 81 } // namespace gfx |
80 | 82 |
81 #endif // UI_GFX_ANIMATION_TWEEN_H_ | 83 #endif // UI_GFX_ANIMATION_TWEEN_H_ |
OLD | NEW |