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

Side by Side Diff: cc/animation/timing_function.h

Issue 140253013: Define accelerated steps time function. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated patch: put Steps and CubicBezier in ui/gfx/animation Created 6 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 unified diff | Download patch
« no previous file with comments | « cc/animation/keyframed_animation_curve_unittest.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/animation/cubic_bezier.h"
11 #include "ui/gfx/animation/steps.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 // See http://www.w3.org/TR/css3-transitions/. 15 // See http://www.w3.org/TR/css3-transitions/.
15 class CC_EXPORT TimingFunction : public FloatAnimationCurve { 16 class CC_EXPORT TimingFunction : public FloatAnimationCurve {
16 public: 17 public:
17 virtual ~TimingFunction(); 18 virtual ~TimingFunction();
18 19
19 // Partial implementation of FloatAnimationCurve. 20 // Partial implementation of FloatAnimationCurve.
20 virtual double Duration() const OVERRIDE; 21 virtual double Duration() const OVERRIDE;
(...skipping 25 matching lines...) Expand all
46 47
47 protected: 48 protected:
48 CubicBezierTimingFunction(double x1, double y1, double x2, double y2); 49 CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
49 50
50 gfx::CubicBezier bezier_; 51 gfx::CubicBezier bezier_;
51 52
52 private: 53 private:
53 DISALLOW_ASSIGN(CubicBezierTimingFunction); 54 DISALLOW_ASSIGN(CubicBezierTimingFunction);
54 }; 55 };
55 56
57 class CC_EXPORT StepsTimingFunction : public TimingFunction {
58 public:
59 static scoped_ptr<StepsTimingFunction> Create(int steps, bool steps_at_start);
60 virtual ~StepsTimingFunction();
61
62 virtual float GetValue(double time) const OVERRIDE;
63 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
64 virtual void Range(float* min, float* max) const OVERRIDE;
65 // XXX: Should Velocity be a CubicBezierTimingFunction only? It seems to be
66 // used only for ScrollOffsetAnimationCurve. Do ScrollOffsetAnimationCurve
67 // with non bezier curves make sense?
ajuma 2014/09/16 14:50:15 ScrollOffsetAnimationCurves with non-bezier curves
68 virtual float Velocity(double time) const OVERRIDE;
69
70 protected:
71 StepsTimingFunction(int steps, bool steps_at_start);
72
73 gfx::Steps steps_;
74
75 private:
76 DISALLOW_ASSIGN(StepsTimingFunction);
77 };
78
56 class CC_EXPORT EaseTimingFunction { 79 class CC_EXPORT EaseTimingFunction {
57 public: 80 public:
58 static scoped_ptr<TimingFunction> Create(); 81 static scoped_ptr<TimingFunction> Create();
59 82
60 private: 83 private:
61 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseTimingFunction); 84 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseTimingFunction);
62 }; 85 };
63 86
64 class CC_EXPORT EaseInTimingFunction { 87 class CC_EXPORT EaseInTimingFunction {
65 public: 88 public:
(...skipping 15 matching lines...) Expand all
81 public: 104 public:
82 static scoped_ptr<TimingFunction> Create(); 105 static scoped_ptr<TimingFunction> Create();
83 106
84 private: 107 private:
85 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction); 108 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction);
86 }; 109 };
87 110
88 } // namespace cc 111 } // namespace cc
89 112
90 #endif // CC_ANIMATION_TIMING_FUNCTION_H_ 113 #endif // CC_ANIMATION_TIMING_FUNCTION_H_
OLDNEW
« no previous file with comments | « cc/animation/keyframed_animation_curve_unittest.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698