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.
5 #ifndef CCKeyframedAnimationCurve_h
6 #define CCKeyframedAnimationCurve_h
8 #include "CCAnimationCurve.h"
9 #include "CCTimingFunction.h"
10 #include <public/WebTransformOperations.h>
11 #include <wtf/OwnPtr.h>
12 #include <wtf/PassOwnPtr.h>
13 #include <wtf/Vector.h>
20 const CCTimingFunction
* timingFunction() const;
23 CCKeyframe(double time
, PassOwnPtr
<CCTimingFunction
>);
24 virtual ~CCKeyframe();
28 OwnPtr
<CCTimingFunction
> m_timingFunction
;
31 class CCFloatKeyframe
: public CCKeyframe
{
33 static PassOwnPtr
<CCFloatKeyframe
> create(double time
, float value
, PassOwnPtr
<CCTimingFunction
>);
34 virtual ~CCFloatKeyframe();
38 PassOwnPtr
<CCFloatKeyframe
> clone() const;
41 CCFloatKeyframe(double time
, float value
, PassOwnPtr
<CCTimingFunction
>);
46 class CCTransformKeyframe
: public CCKeyframe
{
48 static PassOwnPtr
<CCTransformKeyframe
> create(double time
, const WebKit::WebTransformOperations
& value
, PassOwnPtr
<CCTimingFunction
>);
49 virtual ~CCTransformKeyframe();
51 const WebKit::WebTransformOperations
& value() const;
53 PassOwnPtr
<CCTransformKeyframe
> clone() const;
56 CCTransformKeyframe(double time
, const WebKit::WebTransformOperations
& value
, PassOwnPtr
<CCTimingFunction
>);
58 WebKit::WebTransformOperations m_value
;
61 class CCKeyframedFloatAnimationCurve
: public CCFloatAnimationCurve
{
63 // It is required that the keyframes be sorted by time.
64 static PassOwnPtr
<CCKeyframedFloatAnimationCurve
> create();
66 virtual ~CCKeyframedFloatAnimationCurve();
68 void addKeyframe(PassOwnPtr
<CCFloatKeyframe
>);
70 // CCAnimationCurve implementation
71 virtual double duration() const OVERRIDE
;
72 virtual PassOwnPtr
<CCAnimationCurve
> clone() const OVERRIDE
;
74 // CCFloatAnimationCurve implementation
75 virtual float getValue(double t
) const OVERRIDE
;
78 CCKeyframedFloatAnimationCurve();
80 // Always sorted in order of increasing time. No two keyframes have the
82 Vector
<OwnPtr
<CCFloatKeyframe
> > m_keyframes
;
85 class CCKeyframedTransformAnimationCurve
: public CCTransformAnimationCurve
{
87 // It is required that the keyframes be sorted by time.
88 static PassOwnPtr
<CCKeyframedTransformAnimationCurve
> create();
90 virtual ~CCKeyframedTransformAnimationCurve();
92 void addKeyframe(PassOwnPtr
<CCTransformKeyframe
>);
94 // CCAnimationCurve implementation
95 virtual double duration() const OVERRIDE
;
96 virtual PassOwnPtr
<CCAnimationCurve
> clone() const OVERRIDE
;
98 // CCTransformAnimationCurve implementation
99 virtual WebKit::WebTransformationMatrix
getValue(double t
) const OVERRIDE
;
102 CCKeyframedTransformAnimationCurve();
104 // Always sorted in order of increasing time. No two keyframes have the
106 Vector
<OwnPtr
<CCTransformKeyframe
> > m_keyframes
;
109 } // namespace WebCore
111 #endif // CCKeyframedAnimationCurve_h