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

Side by Side Diff: chrome/browser/android/vr_shell/easing.h

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 years, 5 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
« no previous file with comments | « chrome/browser/android/vr_shell/animation.cc ('k') | chrome/browser/android/vr_shell/easing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_
7
8 #include "base/macros.h"
9 #include "ui/gfx/geometry/cubic_bezier.h"
10
11 namespace vr_shell {
12 namespace easing {
13
14 enum EasingType {
15 LINEAR = 0,
16 CUBICBEZIER,
17 EASEIN,
18 EASEOUT,
19 EASEINOUT,
20 };
21
22 // Abstract base class for custom interpolators, mapping linear input between
23 // 0 and 1 to custom values between those two points.
24 class Easing {
25 public:
26 // Compute an output value, given an input between 0 and 1. Output will
27 // equal input at (at least) points 0 and 1.
28 double CalculateValue(double input);
29 virtual ~Easing() {}
30
31 protected:
32 Easing() {}
33 virtual double CalculateValueImpl(double input) = 0;
34
35 private:
36 DISALLOW_COPY_AND_ASSIGN(Easing);
37 };
38
39 // Linear interpolation generates output equal to input.
40 class Linear : public Easing {
41 public:
42 Linear() = default;
43 double CalculateValueImpl(double input) override;
44
45 private:
46 DISALLOW_COPY_AND_ASSIGN(Linear);
47 };
48
49 // Computes a cubic-bezier transition based on two control points.
50 class CubicBezier : public Easing {
51 public:
52 CubicBezier(double p1x, double p1y, double p2x, double p2y);
53 double CalculateValueImpl(double input) override;
54
55 private:
56 gfx::CubicBezier bezier_;
57 DISALLOW_COPY_AND_ASSIGN(CubicBezier);
58 };
59
60 // Computes |input|^|power|.
61 class EaseIn : public Easing {
62 public:
63 explicit EaseIn(double power);
64 double CalculateValueImpl(double input) override;
65
66 private:
67 double power_;
68 DISALLOW_COPY_AND_ASSIGN(EaseIn);
69 };
70
71 // Computes 1 - |input|^|power|.
72 class EaseOut : public Easing {
73 public:
74 explicit EaseOut(double power);
75 double CalculateValueImpl(double input) override;
76
77 private:
78 double power_;
79 DISALLOW_COPY_AND_ASSIGN(EaseOut);
80 };
81
82 // Starts with EaseIn and finishes with EaseOut.
83 class EaseInOut : public Easing {
84 public:
85 explicit EaseInOut(double power);
86 double CalculateValueImpl(double input) override;
87
88 private:
89 EaseIn ease_in_;
90 DISALLOW_COPY_AND_ASSIGN(EaseInOut);
91 };
92
93 } // namespace easing
94 } // namespace vr_shell
95
96 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/animation.cc ('k') | chrome/browser/android/vr_shell/easing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698