Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "ui/gfx/geometry/cubic_bezier.h" | |
| 9 | |
| 10 namespace vr_shell { | |
| 11 | |
| 12 enum EasingType { | |
|
David Trainor- moved to gerrit
2016/09/14 21:43:29
Any reason to keep these outside the easing namesp
cjgrant
2016/09/16 17:47:08
Done. Also, I removed the EasingType, as Easing i
| |
| 13 LINEAR = 0, | |
| 14 CUBICBEZIER, | |
| 15 EASEIN, | |
| 16 EASEOUT | |
| 17 }; | |
| 18 | |
| 19 class Easing { | |
|
David Trainor- moved to gerrit
2016/09/14 21:43:30
Should this just be called Interpolator? At least
cjgrant
2016/09/16 17:47:08
It could be, but as per http://www.w3schools.com/c
David Trainor- moved to gerrit
2016/09/16 21:25:44
Not particularly :). Just a suggestion.
| |
| 20 public: | |
| 21 virtual double CalculateValue(double state) = 0; | |
|
David Trainor- moved to gerrit
2016/09/14 21:43:30
Should we add a comment specifying the expected in
cjgrant
2016/09/16 17:47:08
Done.
| |
| 22 virtual ~Easing() {} | |
| 23 protected: | |
|
David Trainor- moved to gerrit
2016/09/14 21:43:30
new line before protected and private
Same for al
cjgrant
2016/09/16 17:47:08
Done.
cjgrant
2016/09/16 17:47:08
Done.
| |
| 24 Easing() {} | |
| 25 private: | |
| 26 DISALLOW_COPY_AND_ASSIGN(Easing); | |
| 27 }; | |
| 28 | |
| 29 namespace easing { | |
| 30 | |
| 31 class CubicBezier : public Easing { | |
| 32 public: | |
| 33 CubicBezier(double p1x, double p1y, double p2x, double p2y); | |
| 34 double CalculateValue(double state) override; | |
| 35 private: | |
|
David Trainor- moved to gerrit
2016/09/14 21:43:30
I forget if you still need DISALLOW_COPY_AND_ASSIG
cjgrant
2016/09/16 17:47:08
Done.
| |
| 36 gfx::CubicBezier bezier_; | |
| 37 }; | |
| 38 | |
| 39 class EaseIn : public Easing { | |
| 40 public: | |
| 41 explicit EaseIn(double power); | |
| 42 double CalculateValue(double state) override; | |
| 43 private: | |
| 44 double power_; | |
| 45 }; | |
| 46 | |
| 47 class EaseOut : public Easing { | |
| 48 public: | |
| 49 explicit EaseOut(double power); | |
| 50 double CalculateValue(double state) override; | |
| 51 private: | |
| 52 double power_; | |
| 53 }; | |
| 54 | |
| 55 class Linear : public Easing { | |
| 56 public: | |
| 57 double CalculateValue(double state) override; | |
| 58 }; | |
| 59 | |
| 60 } // namespace easing | |
| 61 | |
| 62 } // namespace vr_shell | |
| 63 | |
| 64 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ | |
| OLD | NEW |