clang/win: Try to fix 64-bit build more after https://codereview.chromium.org/1261953003.
[chromium-blink-merge.git] / cc / animation / timing_function.h
blob95144a7cfd7f9d49f2aecac4d97151c3803d4c70
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/base/cc_export.h"
9 #include "ui/gfx/geometry/cubic_bezier.h"
11 namespace cc {
13 // See http://www.w3.org/TR/css3-transitions/.
14 class CC_EXPORT TimingFunction {
15 public:
16 virtual ~TimingFunction();
18 virtual float GetValue(double t) const = 0;
19 virtual float Velocity(double time) const = 0;
20 // The smallest and largest values returned by GetValue for inputs in [0, 1].
21 virtual void Range(float* min, float* max) const = 0;
22 virtual scoped_ptr<TimingFunction> Clone() const = 0;
24 protected:
25 TimingFunction();
27 private:
28 DISALLOW_ASSIGN(TimingFunction);
31 class CC_EXPORT CubicBezierTimingFunction : public TimingFunction {
32 public:
33 static scoped_ptr<CubicBezierTimingFunction> Create(double x1, double y1,
34 double x2, double y2);
35 ~CubicBezierTimingFunction() override;
37 // TimingFunction implementation.
38 float GetValue(double time) const override;
39 float Velocity(double time) const override;
40 void Range(float* min, float* max) const override;
41 scoped_ptr<TimingFunction> Clone() const override;
43 protected:
44 CubicBezierTimingFunction(double x1, double y1, double x2, double y2);
46 gfx::CubicBezier bezier_;
48 private:
49 DISALLOW_ASSIGN(CubicBezierTimingFunction);
52 class CC_EXPORT EaseTimingFunction {
53 public:
54 static scoped_ptr<TimingFunction> Create();
56 private:
57 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseTimingFunction);
60 class CC_EXPORT EaseInTimingFunction {
61 public:
62 static scoped_ptr<TimingFunction> Create();
64 private:
65 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInTimingFunction);
68 class CC_EXPORT EaseOutTimingFunction {
69 public:
70 static scoped_ptr<TimingFunction> Create();
72 private:
73 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseOutTimingFunction);
76 class CC_EXPORT EaseInOutTimingFunction {
77 public:
78 static scoped_ptr<TimingFunction> Create();
80 private:
81 DISALLOW_IMPLICIT_CONSTRUCTORS(EaseInOutTimingFunction);
84 class CC_EXPORT StepsTimingFunction : public TimingFunction {
85 public:
86 static scoped_ptr<StepsTimingFunction> Create(int steps,
87 float steps_start_offset);
88 ~StepsTimingFunction() override;
90 float GetValue(double t) const override;
91 scoped_ptr<TimingFunction> Clone() const override;
93 void Range(float* min, float* max) const override;
94 float Velocity(double time) const override;
96 protected:
97 StepsTimingFunction(int steps, float steps_start_offset);
99 private:
100 int steps_;
101 float steps_start_offset_;
103 DISALLOW_ASSIGN(StepsTimingFunction);
106 } // namespace cc
108 #endif // CC_ANIMATION_TIMING_FUNCTION_H_