libwebp: update to 0.4.1
[chromium-blink-merge.git] / cc / animation / timing_function.h
blobcc979398e4b4b098ece44d57269c1e220605129b
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_TIMING_FUNCTION_H_
6 #define CC_ANIMATION_TIMING_FUNCTION_H_
8 #include "cc/animation/animation_curve.h"
9 #include "cc/base/cc_export.h"
10 #include "ui/gfx/geometry/cubic_bezier.h"
12 namespace cc {
14 // See http://www.w3.org/TR/css3-transitions/.
15 class CC_EXPORT TimingFunction : public FloatAnimationCurve {
16 public:
17 virtual ~TimingFunction();
19 // Partial implementation of FloatAnimationCurve.
20 virtual double Duration() const OVERRIDE;
22 // The smallest and largest values returned by GetValue for inputs in
23 // [0, 1].
24 virtual void Range(float* min, float* max) const = 0;
25 virtual float Velocity(double time) const = 0;
27 protected:
28 TimingFunction();
30 private:
31 DISALLOW_ASSIGN(TimingFunction);
34 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction {
35 public:
36 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1,
37 double x2, double y2);
38 virtual ~CubicBezierTimingFunction();
40 // Partial implementation of FloatAnimationCurve.
41 virtual float GetValue(double time) const OVERRIDE;
42 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
44 virtual void Range(float* min, float* max) const OVERRIDE;
45 virtual float Velocity(double time) const OVERRIDE;
47 protected:
48 CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
50 gfx::CubicBezier bezier_;
52 private:
53 DISALLOW_ASSIGN(CubicBezierTimingFunction);
56 class CC_EXPORT EaseTimingFunction {
57 public:
58 static scoped_ptr<TimingFunction> Create();
60 private:
61 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseTimingFunction);
64 class CC_EXPORT EaseInTimingFunction {
65 public:
66 static scoped_ptr<TimingFunction> Create();
68 private:
69 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInTimingFunction);
72 class CC_EXPORT EaseOutTimingFunction {
73 public:
74 static scoped_ptr<TimingFunction> Create();
76 private:
77 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseOutTimingFunction);
80 class CC_EXPORT EaseInOutTimingFunction {
81 public:
82 static scoped_ptr<TimingFunction> Create();
84 private:
85 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction);
88 } // namespace cc
90 #endif // CC_ANIMATION_TIMING_FUNCTION_H_