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 CC_ANIMATION_CURVE_H_
6 #define CC_ANIMATION_CURVE_H_
8 #include <public/WebTransformationMatrix.h>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/cc_export.h"
15 class FloatAnimationCurve
;
16 class TransformAnimationCurve
;
17 class TransformOperations
;
19 // An animation curve is a function that returns a value given a time.
20 // There are currently only two types of curve, float and transform.
21 class CC_EXPORT AnimationCurve
{
23 enum Type
{ Float
, Transform
};
25 virtual ~AnimationCurve() { }
27 virtual double duration() const = 0;
28 virtual Type
type() const = 0;
29 virtual scoped_ptr
<AnimationCurve
> clone() const = 0;
31 const FloatAnimationCurve
* toFloatAnimationCurve() const;
32 const TransformAnimationCurve
* toTransformAnimationCurve() const;
35 class CC_EXPORT FloatAnimationCurve
: public AnimationCurve
{
37 virtual ~FloatAnimationCurve() { }
39 virtual float getValue(double t
) const = 0;
41 // Partial Animation implementation.
42 virtual Type
type() const OVERRIDE
;
45 class CC_EXPORT TransformAnimationCurve
: public AnimationCurve
{
47 virtual ~TransformAnimationCurve() { }
49 virtual WebKit::WebTransformationMatrix
getValue(double t
) const = 0;
51 // Partial Animation implementation.
52 virtual Type
type() const OVERRIDE
;
57 #endif // CC_ANIMATION_CURVE_H_