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

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

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
Index: chrome/browser/android/vr_shell/easing.h
diff --git a/chrome/browser/android/vr_shell/easing.h b/chrome/browser/android/vr_shell/easing.h
new file mode 100644
index 0000000000000000000000000000000000000000..4122889a25a201e9878fe077d8486db6265d894b
--- /dev/null
+++ b/chrome/browser/android/vr_shell/easing.h
@@ -0,0 +1,64 @@
+// 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.
+
+#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_
+
+#include "ui/gfx/geometry/cubic_bezier.h"
+
+namespace vr_shell {
+
+enum EasingType {
David Trainor- moved to gerrit 2016/09/14 21:43:29 Any reason to keep these outside the easing namesp
cjgrant 2016/09/16 17:47:08 Done. Also, I removed the EasingType, as Easing i
+ LINEAR = 0,
+ CUBICBEZIER,
+ EASEIN,
+ EASEOUT
+};
+
+class Easing {
David Trainor- moved to gerrit 2016/09/14 21:43:30 Should this just be called Interpolator? At least
cjgrant 2016/09/16 17:47:08 It could be, but as per http://www.w3schools.com/c
David Trainor- moved to gerrit 2016/09/16 21:25:44 Not particularly :). Just a suggestion.
+ public:
+ virtual double CalculateValue(double state) = 0;
David Trainor- moved to gerrit 2016/09/14 21:43:30 Should we add a comment specifying the expected in
cjgrant 2016/09/16 17:47:08 Done.
+ virtual ~Easing() {}
+ protected:
David Trainor- moved to gerrit 2016/09/14 21:43:30 new line before protected and private Same for al
cjgrant 2016/09/16 17:47:08 Done.
cjgrant 2016/09/16 17:47:08 Done.
+ Easing() {}
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Easing);
+};
+
+namespace easing {
+
+class CubicBezier : public Easing {
+ public:
+ CubicBezier(double p1x, double p1y, double p2x, double p2y);
+ double CalculateValue(double state) override;
+ private:
David Trainor- moved to gerrit 2016/09/14 21:43:30 I forget if you still need DISALLOW_COPY_AND_ASSIG
cjgrant 2016/09/16 17:47:08 Done.
+ gfx::CubicBezier bezier_;
+};
+
+class EaseIn : public Easing {
+ public:
+ explicit EaseIn(double power);
+ double CalculateValue(double state) override;
+ private:
+ double power_;
+};
+
+class EaseOut : public Easing {
+ public:
+ explicit EaseOut(double power);
+ double CalculateValue(double state) override;
+ private:
+ double power_;
+};
+
+class Linear : public Easing {
+ public:
+ double CalculateValue(double state) override;
+};
+
+} // namespace easing
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_EASING_H_

Powered by Google App Engine
This is Rietveld 408576698