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 <cmath> | |
| 9 | |
| 10 #include "base/logging.h" | |
|
bshe
2016/09/12 15:38:26
incorrect include? You probably just want base/mac
cjgrant
2016/09/13 17:32:16
Done.
| |
| 11 #include "ui/gfx/geometry/cubic_bezier.h" | |
|
bshe
2016/09/12 15:38:26
move this include to .cc?
cjgrant
2016/09/13 17:32:16
This is needed for the CubicBezier type.
| |
| 12 | |
| 13 namespace vr_shell { | |
| 14 | |
| 15 enum EasingType { | |
| 16 LINEAR = 0, | |
| 17 CUBICBEZIER, | |
| 18 EASEIN, | |
| 19 EASEOUT | |
| 20 }; | |
| 21 | |
| 22 class Easing { | |
| 23 public: | |
| 24 virtual double CalculateValue(double state) = 0; | |
| 25 virtual ~Easing() {} | |
| 26 protected: | |
| 27 Easing() {} | |
| 28 DISALLOW_COPY_AND_ASSIGN(Easing); | |
|
bshe
2016/09/12 15:38:26
DISALLOW_COPY_AND_ASSIGN should be private
cjgrant
2016/09/13 17:32:15
Done.
| |
| 29 }; | |
| 30 | |
| 31 namespace easing { | |
| 32 | |
| 33 class CubicBezier : public Easing { | |
| 34 public: | |
| 35 CubicBezier(double p1x, double p1y, double p2x, double p2y); | |
| 36 double CalculateValue(double state) override; | |
| 37 private: | |
| 38 gfx::CubicBezier bezier; | |
|
bshe
2016/09/12 15:38:26
nit: s/bezier/bezier_
cjgrant
2016/09/13 17:32:16
Done.
| |
| 39 }; | |
| 40 | |
| 41 class EaseIn : public Easing { | |
| 42 public: | |
| 43 explicit EaseIn(double power); | |
| 44 double CalculateValue(double state) override; | |
| 45 private: | |
| 46 double mPower; | |
|
bshe
2016/09/12 15:38:26
nit: s/mPower/m_power_
cjgrant
2016/09/13 17:32:16
Done (power_).
| |
| 47 }; | |
| 48 | |
| 49 class EaseOut : public Easing { | |
| 50 public: | |
| 51 explicit EaseOut(double power); | |
| 52 double CalculateValue(double state) override; | |
| 53 private: | |
| 54 double mPower; | |
|
bshe
2016/09/12 15:38:26
nit: s/mPower/m_power_
cjgrant
2016/09/13 17:32:16
Done.
| |
| 55 }; | |
| 56 | |
| 57 class Linear : public Easing { | |
| 58 public: | |
| 59 double CalculateValue(double state) override; | |
| 60 }; | |
| 61 | |
| 62 } // namespace easing | |
| 63 | |
| 64 } // namespace vr_shell | |
| 65 | |
| 66 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ | |
| OLD | NEW |