blob: 6f1f92da08cb345ecb53600333e26edb51890d7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CCKeyframedAnimationCurve_h
#define CCKeyframedAnimationCurve_h
#include "CCAnimationCurve.h"
#include "CCTimingFunction.h"
#include <public/WebTransformOperations.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace cc {
class CCKeyframe {
public:
double time() const;
const CCTimingFunction* timingFunction() const;
protected:
CCKeyframe(double time, PassOwnPtr<CCTimingFunction>);
virtual ~CCKeyframe();
private:
double m_time;
OwnPtr<CCTimingFunction> m_timingFunction;
};
class CCFloatKeyframe : public CCKeyframe {
public:
static PassOwnPtr<CCFloatKeyframe> create(double time, float value, PassOwnPtr<CCTimingFunction>);
virtual ~CCFloatKeyframe();
float value() const;
PassOwnPtr<CCFloatKeyframe> clone() const;
private:
CCFloatKeyframe(double time, float value, PassOwnPtr<CCTimingFunction>);
float m_value;
};
class CCTransformKeyframe : public CCKeyframe {
public:
static PassOwnPtr<CCTransformKeyframe> create(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction>);
virtual ~CCTransformKeyframe();
const WebKit::WebTransformOperations& value() const;
PassOwnPtr<CCTransformKeyframe> clone() const;
private:
CCTransformKeyframe(double time, const WebKit::WebTransformOperations& value, PassOwnPtr<CCTimingFunction>);
WebKit::WebTransformOperations m_value;
};
class CCKeyframedFloatAnimationCurve : public CCFloatAnimationCurve {
public:
// It is required that the keyframes be sorted by time.
static PassOwnPtr<CCKeyframedFloatAnimationCurve> create();
virtual ~CCKeyframedFloatAnimationCurve();
void addKeyframe(PassOwnPtr<CCFloatKeyframe>);
// CCAnimationCurve implementation
virtual double duration() const OVERRIDE;
virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE;
// CCFloatAnimationCurve implementation
virtual float getValue(double t) const OVERRIDE;
private:
CCKeyframedFloatAnimationCurve();
// Always sorted in order of increasing time. No two keyframes have the
// same time.
Vector<OwnPtr<CCFloatKeyframe> > m_keyframes;
};
class CCKeyframedTransformAnimationCurve : public CCTransformAnimationCurve {
public:
// It is required that the keyframes be sorted by time.
static PassOwnPtr<CCKeyframedTransformAnimationCurve> create();
virtual ~CCKeyframedTransformAnimationCurve();
void addKeyframe(PassOwnPtr<CCTransformKeyframe>);
// CCAnimationCurve implementation
virtual double duration() const OVERRIDE;
virtual PassOwnPtr<CCAnimationCurve> clone() const OVERRIDE;
// CCTransformAnimationCurve implementation
virtual WebKit::WebTransformationMatrix getValue(double t) const OVERRIDE;
private:
CCKeyframedTransformAnimationCurve();
// Always sorted in order of increasing time. No two keyframes have the
// same time.
Vector<OwnPtr<CCTransformKeyframe> > m_keyframes;
};
} // namespace cc
#endif // CCKeyframedAnimationCurve_h
|