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

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

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.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..fda9e266d1b625a176f6ed505e0f2057f08f6f6f
--- /dev/null
+++ b/chrome/browser/android/vr_shell/easing.h
@@ -0,0 +1,66 @@
+// 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 <cmath>
+
+#include "base/logging.h"
bshe 2016/09/12 15:38:26 incorrect include? You probably just want base/mac
cjgrant 2016/09/13 17:32:16 Done.
+#include "ui/gfx/geometry/cubic_bezier.h"
bshe 2016/09/12 15:38:26 move this include to .cc?
cjgrant 2016/09/13 17:32:16 This is needed for the CubicBezier type.
+
+namespace vr_shell {
+
+enum EasingType {
+ LINEAR = 0,
+ CUBICBEZIER,
+ EASEIN,
+ EASEOUT
+};
+
+class Easing {
+ public:
+ virtual double CalculateValue(double state) = 0;
+ virtual ~Easing() {}
+ protected:
+ Easing() {}
+ DISALLOW_COPY_AND_ASSIGN(Easing);
bshe 2016/09/12 15:38:26 DISALLOW_COPY_AND_ASSIGN should be private
cjgrant 2016/09/13 17:32:15 Done.
+};
+
+namespace easing {
+
+class CubicBezier : public Easing {
+ public:
+ CubicBezier(double p1x, double p1y, double p2x, double p2y);
+ double CalculateValue(double state) override;
+ private:
+ gfx::CubicBezier bezier;
bshe 2016/09/12 15:38:26 nit: s/bezier/bezier_
cjgrant 2016/09/13 17:32:16 Done.
+};
+
+class EaseIn : public Easing {
+ public:
+ explicit EaseIn(double power);
+ double CalculateValue(double state) override;
+ private:
+ double mPower;
bshe 2016/09/12 15:38:26 nit: s/mPower/m_power_
cjgrant 2016/09/13 17:32:16 Done (power_).
+};
+
+class EaseOut : public Easing {
+ public:
+ explicit EaseOut(double power);
+ double CalculateValue(double state) override;
+ private:
+ double mPower;
bshe 2016/09/12 15:38:26 nit: s/mPower/m_power_
cjgrant 2016/09/13 17:32:16 Done.
+};
+
+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