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_ANIMATION_CURVE_H_
6 #define CC_ANIMATION_ANIMATION_CURVE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "ui/gfx/transform.h"
14 class FloatAnimationCurve
;
15 class TransformAnimationCurve
;
16 class TransformOperations
;
18 // An animation curve is a function that returns a value given a time.
19 // There are currently only two types of curve, float and transform.
20 class CC_EXPORT AnimationCurve
{
22 enum CurveType
{ Float
, Transform
};
24 virtual ~AnimationCurve() {}
26 virtual double Duration() const = 0;
27 virtual CurveType
Type() const = 0;
28 virtual scoped_ptr
<AnimationCurve
> Clone() const = 0;
30 const FloatAnimationCurve
* ToFloatAnimationCurve() const;
31 const TransformAnimationCurve
* ToTransformAnimationCurve() const;
34 class CC_EXPORT FloatAnimationCurve
: public AnimationCurve
{
36 virtual ~FloatAnimationCurve() {}
38 virtual float GetValue(double t
) const = 0;
40 // Partial Animation implementation.
41 virtual CurveType
Type() const OVERRIDE
;
44 class CC_EXPORT TransformAnimationCurve
: public AnimationCurve
{
46 virtual ~TransformAnimationCurve() {}
48 virtual gfx::Transform
GetValue(double t
) const = 0;
50 // Partial Animation implementation.
51 virtual CurveType
Type() const OVERRIDE
;
56 #endif // CC_ANIMATION_ANIMATION_CURVE_H_