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

Side by Side Diff: cc/keyframed_animation_curve.h

Issue 12822004: Part 3 of cc/ directory shuffles: animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/keyframed_animation_curve.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_KEYFRAMED_ANIMATION_CURVE_H_
6 #define CC_KEYFRAMED_ANIMATION_CURVE_H_
7
8 #include "cc/animation_curve.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/base/scoped_ptr_vector.h"
11 #include "cc/timing_function.h"
12 #include "cc/transform_operations.h"
13
14 namespace cc {
15
16 class CC_EXPORT Keyframe {
17 public:
18 double Time() const;
19 const TimingFunction* timing_function() const {
20 return timing_function_.get();
21 }
22
23 protected:
24 Keyframe(double time, scoped_ptr<TimingFunction> timing_function);
25 virtual ~Keyframe();
26
27 private:
28 double time_;
29 scoped_ptr<TimingFunction> timing_function_;
30
31 DISALLOW_COPY_AND_ASSIGN(Keyframe);
32 };
33
34 class CC_EXPORT FloatKeyframe : public Keyframe {
35 public:
36 static scoped_ptr<FloatKeyframe> Create(
37 double time,
38 float value,
39 scoped_ptr<TimingFunction> timing_function);
40 virtual ~FloatKeyframe();
41
42 float Value() const;
43
44 scoped_ptr<FloatKeyframe> Clone() const;
45
46 private:
47 FloatKeyframe(double time,
48 float value,
49 scoped_ptr<TimingFunction> timing_function);
50
51 float value_;
52 };
53
54 class CC_EXPORT TransformKeyframe : public Keyframe {
55 public:
56 static scoped_ptr<TransformKeyframe> Create(
57 double time,
58 const TransformOperations& value,
59 scoped_ptr<TimingFunction> timing_function);
60 virtual ~TransformKeyframe();
61
62 const TransformOperations& Value() const;
63
64 scoped_ptr<TransformKeyframe> Clone() const;
65
66 private:
67 TransformKeyframe(
68 double time,
69 const TransformOperations& value,
70 scoped_ptr<TimingFunction> timing_function);
71
72 TransformOperations value_;
73 };
74
75 class CC_EXPORT KeyframedFloatAnimationCurve : public FloatAnimationCurve {
76 public:
77 // It is required that the keyframes be sorted by time.
78 static scoped_ptr<KeyframedFloatAnimationCurve> Create();
79
80 virtual ~KeyframedFloatAnimationCurve();
81
82 void AddKeyframe(scoped_ptr<FloatKeyframe> keyframe);
83
84 // AnimationCurve implementation
85 virtual double Duration() const OVERRIDE;
86 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
87
88 // FloatAnimationCurve implementation
89 virtual float GetValue(double t) const OVERRIDE;
90
91 private:
92 KeyframedFloatAnimationCurve();
93
94 // Always sorted in order of increasing time. No two keyframes have the
95 // same time.
96 ScopedPtrVector<FloatKeyframe> keyframes_;
97
98 DISALLOW_COPY_AND_ASSIGN(KeyframedFloatAnimationCurve);
99 };
100
101 class CC_EXPORT KeyframedTransformAnimationCurve : public TransformAnimationCurv e {
102 public:
103 // It is required that the keyframes be sorted by time.
104 static scoped_ptr<KeyframedTransformAnimationCurve> Create();
105
106 virtual ~KeyframedTransformAnimationCurve();
107
108 void AddKeyframe(scoped_ptr<TransformKeyframe> keyframe);
109
110 // AnimationCurve implementation
111 virtual double Duration() const OVERRIDE;
112 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
113
114 // TransformAnimationCurve implementation
115 virtual gfx::Transform GetValue(double t) const OVERRIDE;
116
117 private:
118 KeyframedTransformAnimationCurve();
119
120 // Always sorted in order of increasing time. No two keyframes have the
121 // same time.
122 ScopedPtrVector<TransformKeyframe> keyframes_;
123
124 DISALLOW_COPY_AND_ASSIGN(KeyframedTransformAnimationCurve);
125 };
126
127 } // namespace cc
128
129 #endif // CC_KEYFRAMED_ANIMATION_CURVE_H_
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/keyframed_animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698