| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_ANIMATION_TIMING_FUNCTION_H_ | 5 #ifndef CC_ANIMATION_TIMING_FUNCTION_H_ |
| 6 #define CC_ANIMATION_TIMING_FUNCTION_H_ | 6 #define CC_ANIMATION_TIMING_FUNCTION_H_ |
| 7 | 7 |
| 8 #include "cc/animation/animation_curve.h" | 8 #include "cc/animation/animation_curve.h" |
| 9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 10 #include "ui/gfx/geometry/cubic_bezier.h" | 10 #include "ui/gfx/geometry/cubic_bezier.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 // See http://www.w3.org/TR/css3-transitions/. | 14 // See http://www.w3.org/TR/css3-transitions/. |
| 15 class CC_EXPORT TimingFunction : public FloatAnimationCurve { | 15 class CC_EXPORT TimingFunction : public FloatAnimationCurve { |
| 16 public: | 16 public: |
| 17 virtual ~TimingFunction(); | 17 virtual ~TimingFunction(); |
| 18 | 18 |
| 19 // Partial implementation of FloatAnimationCurve. | 19 // Partial implementation of FloatAnimationCurve. |
| 20 virtual double Duration() const OVERRIDE; | 20 virtual double Duration() const OVERRIDE; |
| 21 | 21 |
| 22 // The smallest and largest values returned by GetValue for inputs in | 22 // The smallest and largest values returned by GetValue for inputs in |
| 23 // [0, 1]. | 23 // [0, 1]. |
| 24 virtual void Range(float* min, float* max) const = 0; | 24 virtual void Range(float* min, float* max) const = 0; |
| 25 virtual float Velocity(double time) const = 0; |
| 25 | 26 |
| 26 protected: | 27 protected: |
| 27 TimingFunction(); | 28 TimingFunction(); |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 DISALLOW_ASSIGN(TimingFunction); | 31 DISALLOW_ASSIGN(TimingFunction); |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { | 34 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { |
| 34 public: | 35 public: |
| 35 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1, | 36 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1, |
| 36 double x2, double y2); | 37 double x2, double y2); |
| 37 virtual ~CubicBezierTimingFunction(); | 38 virtual ~CubicBezierTimingFunction(); |
| 38 | 39 |
| 39 // Partial implementation of FloatAnimationCurve. | 40 // Partial implementation of FloatAnimationCurve. |
| 40 virtual float GetValue(double time) const OVERRIDE; | 41 virtual float GetValue(double time) const OVERRIDE; |
| 41 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; | 42 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; |
| 42 | 43 |
| 43 virtual void Range(float* min, float* max) const OVERRIDE; | 44 virtual void Range(float* min, float* max) const OVERRIDE; |
| 45 virtual float Velocity(double time) const OVERRIDE; |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); | 48 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); |
| 47 | 49 |
| 48 gfx::CubicBezier bezier_; | 50 gfx::CubicBezier bezier_; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 DISALLOW_ASSIGN(CubicBezierTimingFunction); | 53 DISALLOW_ASSIGN(CubicBezierTimingFunction); |
| 52 }; | 54 }; |
| 53 | 55 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 79 public: | 81 public: |
| 80 static scoped_ptr<TimingFunction> Create(); | 82 static scoped_ptr<TimingFunction> Create(); |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); | 85 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace cc | 88 } // namespace cc |
| 87 | 89 |
| 88 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ | 90 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ |
| OLD | NEW |