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

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

Issue 2696293002: Adds in-out easing type. (Closed)
Patch Set: Created 3 years, 10 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
index 8138c6dd1f51f4e53d6cf1bb671ae35aee870411..39188b62906879aac47c9283aceca3d1d1c0ca0e 100644
--- a/chrome/browser/android/vr_shell/easing.cc
+++ b/chrome/browser/android/vr_shell/easing.cc
@@ -33,6 +33,15 @@ double EaseOut::CalculateValueImpl(double state) {
return 1.0 - pow(1.0 - state, power_);
}
+EaseInOut::EaseInOut(double power) : ease_in_(power), ease_out_(power) {}
+double EaseInOut::CalculateValueImpl(double state) {
+ if (state < 0.5) {
+ return ease_in_.CalculateValueImpl(state * 2) / 2;
+ } else {
+ return ease_out_.CalculateValueImpl((state - 0.5) * 2) / 2 + 0.5;
mthiesse 2017/02/16 15:36:43 Could reuse ease_in_, i.e. return 1.0 - (ease_in_.
tiborg 2017/02/16 18:39:33 Good call. Math works. Should we do the same for E
mthiesse 2017/02/16 19:15:07 I wouldn't bother, I don't think that would simpli
+ }
+}
+
double Linear::CalculateValueImpl(double state) {
return state;
}

Powered by Google App Engine
This is Rietveld 408576698