Index: cc/animation/timing_function.h |
diff --git a/cc/animation/timing_function.h b/cc/animation/timing_function.h |
index d1807f6f091c90a2cffd947d2f95c20541c1c195..8f021ce735348c7ace44d764a6498a8e21354c8f 100644 |
--- a/cc/animation/timing_function.h |
+++ b/cc/animation/timing_function.h |
@@ -18,6 +18,10 @@ class CC_EXPORT TimingFunction { |
public: |
virtual ~TimingFunction(); |
+ // Note that LINEAR is a nullptr TimingFunction (for now). |
+ enum class Type { LINEAR, CUBIC_BEZIER, STEPS }; |
+ |
+ virtual Type GetType() const = 0; |
virtual float GetValue(double t) const = 0; |
virtual float Velocity(double time) const = 0; |
// The smallest and largest values returned by GetValue for inputs in [0, 1]. |
@@ -43,15 +47,23 @@ class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { |
~CubicBezierTimingFunction() override; |
// TimingFunction implementation. |
+ Type GetType() const override; |
float GetValue(double time) const override; |
float Velocity(double time) const override; |
void Range(float* min, float* max) const override; |
std::unique_ptr<TimingFunction> Clone() const override; |
+ EaseType ease_type() const { return ease_type_; } |
+ |
protected: |
- CubicBezierTimingFunction(double x1, double y1, double x2, double y2); |
+ CubicBezierTimingFunction(EaseType ease_type, |
+ double x1, |
+ double y1, |
+ double x2, |
+ double y2); |
gfx::CubicBezier bezier_; |
+ EaseType ease_type_; |
private: |
DISALLOW_ASSIGN(CubicBezierTimingFunction); |
@@ -99,9 +111,10 @@ class CC_EXPORT StepsTimingFunction : public TimingFunction { |
StepPosition step_position); |
~StepsTimingFunction() override; |
+ // TimingFunction implementation. |
+ Type GetType() const override; |
float GetValue(double t) const override; |
std::unique_ptr<TimingFunction> Clone() const override; |
- |
void Range(float* min, float* max) const override; |
float Velocity(double time) const override; |