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

Side by Side Diff: ui/gfx/animation/tween.h

Issue 2119033002: [Material][Mac] Implement Omnibox Verbose State Chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for rsesek Created 4 years, 4 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
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 #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/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/gfx_export.h" 11 #include "ui/gfx/gfx_export.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 GFX_EXPORT Tween { 20 class GFX_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 FAST_OUT_SLOW_IN_EXPO, // Exponential variant of FAST_OUT_SLOW_IN.
Peter Kasting 2016/08/18 21:15:00 I'm not keen on the functional creep of how we kee
spqchan 2016/08/18 21:56:32 I can email emilyschechter to see if UI is willing
Peter Kasting 2016/08/18 22:05:09 For example, we decide to change the constants on
spqchan 2016/08/18 22:18:33 I see what you mean. Sure thing, currently we're u
35 // fading in from 0% or motion when entering a scene. 35 LINEAR_OUT_SLOW_IN, // Variant of EASE_OUT which should be used for
36 FAST_OUT_LINEAR_IN, // Variant of EASE_IN which should should be used for 36 // fading in from 0% or motion when entering a scene.
37 // fading out to 0% or motion when exiting a scene. 37 FAST_OUT_LINEAR_IN, // Variant of EASE_IN which should should be used for
38 ZERO, // Returns a value of 0 always. 38 // fading out to 0% or motion when exiting a scene.
39 ZERO, // Returns a value of 0 always.
39 }; 40 };
40 41
41 // Returns the value based on the tween type. |state| is from 0-1. 42 // Returns the value based on the tween type. |state| is from 0-1.
42 static double CalculateValue(Type type, double state); 43 static double CalculateValue(Type type, double state);
43 44
44 // Conveniences for getting a value between a start and end point. 45 // Conveniences for getting a value between a start and end point.
45 static SkColor ColorValueBetween(double value, SkColor start, SkColor target); 46 static SkColor ColorValueBetween(double value, SkColor start, SkColor target);
46 static double DoubleValueBetween(double value, double start, double target); 47 static double DoubleValueBetween(double value, double start, double target);
47 static float FloatValueBetween(double value, float start, float target); 48 static float FloatValueBetween(double value, float start, float target);
48 static float ClampedFloatValueBetween(const base::TimeTicks& time, 49 static float ClampedFloatValueBetween(const base::TimeTicks& time,
(...skipping 23 matching lines...) Expand all
72 private: 73 private:
73 Tween(); 74 Tween();
74 ~Tween(); 75 ~Tween();
75 76
76 DISALLOW_COPY_AND_ASSIGN(Tween); 77 DISALLOW_COPY_AND_ASSIGN(Tween);
77 }; 78 };
78 79
79 } // namespace gfx 80 } // namespace gfx
80 81
81 #endif // UI_GFX_ANIMATION_TWEEN_H_ 82 #endif // UI_GFX_ANIMATION_TWEEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698