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" | |
9 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
10 #include "ui/gfx/geometry/cubic_bezier.h" | 9 #include "ui/gfx/geometry/cubic_bezier.h" |
11 | 10 |
12 namespace cc { | 11 namespace cc { |
13 | 12 |
14 // See http://www.w3.org/TR/css3-transitions/. | 13 // See http://www.w3.org/TR/css3-transitions/. |
15 class CC_EXPORT TimingFunction : public FloatAnimationCurve { | 14 class CC_EXPORT TimingFunction { |
16 public: | 15 public: |
17 virtual ~TimingFunction(); | 16 virtual ~TimingFunction(); |
18 | 17 |
19 // Partial implementation of FloatAnimationCurve. | 18 virtual float GetValue(double t) const = 0; |
20 virtual double Duration() const OVERRIDE; | 19 virtual float Velocity(double time) const = 0; |
21 | 20 // The smallest and largest values returned by GetValue for inputs in [0, 1]. |
22 // The smallest and largest values returned by GetValue for inputs in | |
23 // [0, 1]. | |
24 virtual void Range(float* min, float* max) const = 0; | 21 virtual void Range(float* min, float* max) const = 0; |
25 virtual float Velocity(double time) const = 0; | 22 virtual scoped_ptr<TimingFunction> Clone() const = 0; |
ikilpatrick
2014/09/25 05:03:18
Is there an idiomatic ordering?
Should the .cc fil
samli
2014/09/25 07:46:36
Looks fine to me.
ikilpatrick
2014/09/25 08:50:27
Reordered.
| |
26 | 23 |
27 protected: | 24 protected: |
28 TimingFunction(); | 25 TimingFunction(); |
29 | 26 |
30 private: | 27 private: |
31 DISALLOW_ASSIGN(TimingFunction); | 28 DISALLOW_ASSIGN(TimingFunction); |
32 }; | 29 }; |
33 | 30 |
34 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { | 31 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction { |
35 public: | 32 public: |
36 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1, | 33 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1, |
37 double x2, double y2); | 34 double x2, double y2); |
38 virtual ~CubicBezierTimingFunction(); | 35 virtual ~CubicBezierTimingFunction(); |
39 | 36 |
40 // Partial implementation of FloatAnimationCurve. | 37 // TimingFunction implementation. |
41 virtual float GetValue(double time) const OVERRIDE; | 38 virtual float GetValue(double time) const OVERRIDE; |
42 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; | 39 virtual float Velocity(double time) const OVERRIDE; |
43 | |
44 virtual void Range(float* min, float* max) const OVERRIDE; | 40 virtual void Range(float* min, float* max) const OVERRIDE; |
45 virtual float Velocity(double time) const OVERRIDE; | 41 virtual scoped_ptr<TimingFunction> Clone() const OVERRIDE; |
46 | 42 |
47 protected: | 43 protected: |
48 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); | 44 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); |
49 | 45 |
50 gfx::CubicBezier bezier_; | 46 gfx::CubicBezier bezier_; |
51 | 47 |
52 private: | 48 private: |
53 DISALLOW_ASSIGN(CubicBezierTimingFunction); | 49 DISALLOW_ASSIGN(CubicBezierTimingFunction); |
54 }; | 50 }; |
55 | 51 |
(...skipping 25 matching lines...) Expand all Loading... | |
81 public: | 77 public: |
82 static scoped_ptr<TimingFunction> Create(); | 78 static scoped_ptr<TimingFunction> Create(); |
83 | 79 |
84 private: | 80 private: |
85 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); | 81 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); |
86 }; | 82 }; |
87 | 83 |
88 } // namespace cc | 84 } // namespace cc |
89 | 85 |
90 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ | 86 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ |
OLD | NEW |