Index: chrome/browser/android/vr_shell/easing.cc |
diff --git a/chrome/browser/android/vr_shell/easing.cc b/chrome/browser/android/vr_shell/easing.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0be5ec40998cf377282b6c0e883683389c9994c |
--- /dev/null |
+++ b/chrome/browser/android/vr_shell/easing.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/android/vr_shell/easing.h" |
+ |
+#include <cmath> |
+ |
+namespace vr_shell { |
+namespace easing { |
+ |
+CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y) |
+ : bezier_(p1x, p1y, p2x, p2y) {} |
+ |
+double CubicBezier::CalculateValue(double state) { |
+ return bezier_.Solve(state); |
David Trainor- moved to gerrit
2016/09/14 21:43:29
Do we want to DCHECK or clamp state for all of the
cjgrant
2016/09/16 17:47:07
I refactored this to let the check live in the bas
|
+} |
+ |
+EaseIn::EaseIn(double power) : power_(power) {} |
+double EaseIn::CalculateValue(double state) { |
+ return pow(state, power_); |
+} |
+ |
+EaseOut::EaseOut(double power) : power_(power) {} |
+double EaseOut::CalculateValue(double state) { |
+ return 1.0 - pow(1.0 - state, power_); |
+} |
+ |
+double Linear::CalculateValue(double state) { |
+ return state; |
+} |
+ |
+} // namespace easing |
+} // namespace vr_shell |