OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 public: | 87 public: |
88 using EaseType = cc::CubicBezierTimingFunction::EaseType; | 88 using EaseType = cc::CubicBezierTimingFunction::EaseType; |
89 | 89 |
90 static PassRefPtr<CubicBezierTimingFunction> Create(double x1, | 90 static PassRefPtr<CubicBezierTimingFunction> Create(double x1, |
91 double y1, | 91 double y1, |
92 double x2, | 92 double x2, |
93 double y2) { | 93 double y2) { |
94 return AdoptRef(new CubicBezierTimingFunction(x1, y1, x2, y2)); | 94 return AdoptRef(new CubicBezierTimingFunction(x1, y1, x2, y2)); |
95 } | 95 } |
96 | 96 |
97 static CubicBezierTimingFunction* Preset(EaseType ease_type) { | 97 static CubicBezierTimingFunction* Preset(EaseType); |
98 DEFINE_STATIC_REF( | |
99 CubicBezierTimingFunction, ease, | |
100 (AdoptRef(new CubicBezierTimingFunction(EaseType::EASE)))); | |
101 DEFINE_STATIC_REF( | |
102 CubicBezierTimingFunction, ease_in, | |
103 (AdoptRef(new CubicBezierTimingFunction(EaseType::EASE_IN)))); | |
104 DEFINE_STATIC_REF( | |
105 CubicBezierTimingFunction, ease_out, | |
106 (AdoptRef(new CubicBezierTimingFunction(EaseType::EASE_OUT)))); | |
107 DEFINE_STATIC_REF( | |
108 CubicBezierTimingFunction, ease_in_out, | |
109 (AdoptRef(new CubicBezierTimingFunction(EaseType::EASE_IN_OUT)))); | |
110 | |
111 switch (ease_type) { | |
112 case EaseType::EASE: | |
113 return ease; | |
114 case EaseType::EASE_IN: | |
115 return ease_in; | |
116 case EaseType::EASE_OUT: | |
117 return ease_out; | |
118 case EaseType::EASE_IN_OUT: | |
119 return ease_in_out; | |
120 default: | |
121 NOTREACHED(); | |
122 return nullptr; | |
123 } | |
124 } | |
125 | 98 |
126 ~CubicBezierTimingFunction() override {} | 99 ~CubicBezierTimingFunction() override {} |
127 | 100 |
128 // TimingFunction implementation. | 101 // TimingFunction implementation. |
129 String ToString() const override; | 102 String ToString() const override; |
130 double Evaluate(double fraction, double accuracy) const override; | 103 double Evaluate(double fraction, double accuracy) const override; |
131 void Range(double* min_value, double* max_value) const override; | 104 void Range(double* min_value, double* max_value) const override; |
132 std::unique_ptr<cc::TimingFunction> CloneToCC() const override; | 105 std::unique_ptr<cc::TimingFunction> CloneToCC() const override; |
133 | 106 |
134 double X1() const { | 107 double X1() const { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 value.GetType() == TimingFunction::Type::enumName) | 240 value.GetType() == TimingFunction::Type::enumName) |
268 | 241 |
269 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Linear, LINEAR); | 242 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Linear, LINEAR); |
270 DEFINE_TIMING_FUNCTION_TYPE_CASTS(CubicBezier, CUBIC_BEZIER); | 243 DEFINE_TIMING_FUNCTION_TYPE_CASTS(CubicBezier, CUBIC_BEZIER); |
271 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Steps, STEPS); | 244 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Steps, STEPS); |
272 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Frames, FRAMES); | 245 DEFINE_TIMING_FUNCTION_TYPE_CASTS(Frames, FRAMES); |
273 | 246 |
274 } // namespace blink | 247 } // namespace blink |
275 | 248 |
276 #endif // TimingFunction_h | 249 #endif // TimingFunction_h |
OLD | NEW |