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

Unified Diff: chrome/browser/android/vr_shell/easing.cc

Issue 2335643002: Add VR Shell animation classes and unit test. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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..2c8d1713b3923a3adfc58b0031b995abf3666910
--- /dev/null
+++ b/chrome/browser/android/vr_shell/easing.cc
@@ -0,0 +1,31 @@
+// 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"
+
+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);
+}
+
+EaseIn::EaseIn(double power) : mPower(power) {}
+double EaseIn::CalculateValue(double state) {
+ return pow(state, mPower);
+}
+
+EaseOut::EaseOut(double power) : mPower(power) {}
+double EaseOut::CalculateValue(double state) {
+ return 1.0 - pow(1.0 - state, mPower);
+}
+
+double Linear::CalculateValue(double state) {
+ return state;
+}
+
+} // namespace easing
+} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698