| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/geometry/cubic_bezier.h" | 9 #include "ui/gfx/geometry/cubic_bezier.h" |
| 10 | 10 |
| 11 namespace vr_shell { | 11 namespace vr_shell { |
| 12 namespace easing { | 12 namespace easing { |
| 13 | 13 |
| 14 enum EasingType { | 14 enum EasingType { |
| 15 LINEAR = 0, | 15 LINEAR = 0, |
| 16 CUBICBEZIER, | 16 CUBICBEZIER, |
| 17 EASEIN, | 17 EASEIN, |
| 18 EASEOUT, | 18 EASEOUT, |
| 19 EASEINOUT, |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 // Abstract base class for custom interpolators, mapping linear input between | 22 // Abstract base class for custom interpolators, mapping linear input between |
| 22 // 0 and 1 to custom values between those two points. | 23 // 0 and 1 to custom values between those two points. |
| 23 class Easing { | 24 class Easing { |
| 24 public: | 25 public: |
| 25 // Compute an output value, given an input between 0 and 1. Output will | 26 // Compute an output value, given an input between 0 and 1. Output will |
| 26 // equal input at (at least) points 0 and 1. | 27 // equal input at (at least) points 0 and 1. |
| 27 double CalculateValue(double input); | 28 double CalculateValue(double input); |
| 28 virtual ~Easing() {} | 29 virtual ~Easing() {} |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 class EaseOut : public Easing { | 72 class EaseOut : public Easing { |
| 72 public: | 73 public: |
| 73 explicit EaseOut(double power); | 74 explicit EaseOut(double power); |
| 74 double CalculateValueImpl(double input) override; | 75 double CalculateValueImpl(double input) override; |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 double power_; | 78 double power_; |
| 78 DISALLOW_COPY_AND_ASSIGN(EaseOut); | 79 DISALLOW_COPY_AND_ASSIGN(EaseOut); |
| 79 }; | 80 }; |
| 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 |
| 81 } // namespace easing | 93 } // namespace easing |
| 82 } // namespace vr_shell | 94 } // namespace vr_shell |
| 83 | 95 |
| 84 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ | 96 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_ |
| OLD | NEW |