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

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

Issue 2335643002: Add VR Shell animation classes and unit test. (Closed)
Patch Set: Add VR Shell animation classes and unit test. 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
« no previous file with comments | « chrome/browser/android/vr_shell/easing.h ('k') | chrome/browser/android/vr_shell/ui_elements.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8138c6dd1f51f4e53d6cf1bb671ae35aee870411
--- /dev/null
+++ b/chrome/browser/android/vr_shell/easing.cc
@@ -0,0 +1,41 @@
+// 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>
+
+#include "base/logging.h"
+
+namespace vr_shell {
+namespace easing {
+
+double Easing::CalculateValue(double input) {
+ DCHECK(input >= 0.0 && input <= 1.0);
+ return CalculateValueImpl(input);
+}
+
+CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y)
+ : bezier_(p1x, p1y, p2x, p2y) {}
+
+double CubicBezier::CalculateValueImpl(double state) {
+ return bezier_.Solve(state);
+}
+
+EaseIn::EaseIn(double power) : power_(power) {}
+double EaseIn::CalculateValueImpl(double state) {
+ return pow(state, power_);
+}
+
+EaseOut::EaseOut(double power) : power_(power) {}
+double EaseOut::CalculateValueImpl(double state) {
+ return 1.0 - pow(1.0 - state, power_);
+}
+
+double Linear::CalculateValueImpl(double state) {
+ return state;
+}
+
+} // namespace easing
+} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/easing.h ('k') | chrome/browser/android/vr_shell/ui_elements.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698