OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "cc/animation/timing_function.h" | 7 #include "cc/animation/timing_function.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 void CubicBezierTimingFunction::Range(float* min, float* max) const { | 36 void CubicBezierTimingFunction::Range(float* min, float* max) const { |
37 double min_d = 0; | 37 double min_d = 0; |
38 double max_d = 1; | 38 double max_d = 1; |
39 bezier_.Range(&min_d, &max_d); | 39 bezier_.Range(&min_d, &max_d); |
40 *min = static_cast<float>(min_d); | 40 *min = static_cast<float>(min_d); |
41 *max = static_cast<float>(max_d); | 41 *max = static_cast<float>(max_d); |
42 } | 42 } |
43 | 43 |
44 scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const { | 44 scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const { |
45 return make_scoped_ptr(new CubicBezierTimingFunction(*this)) | 45 return make_scoped_ptr(new CubicBezierTimingFunction(*this)); |
46 .PassAs<TimingFunction>(); | |
47 } | 46 } |
48 | 47 |
49 // These numbers come from | 48 // These numbers come from |
50 // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. | 49 // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag. |
51 scoped_ptr<TimingFunction> EaseTimingFunction::Create() { | 50 scoped_ptr<TimingFunction> EaseTimingFunction::Create() { |
52 return CubicBezierTimingFunction::Create( | 51 return CubicBezierTimingFunction::Create(0.25, 0.1, 0.25, 1.0); |
53 0.25, 0.1, 0.25, 1.0).PassAs<TimingFunction>(); | |
54 } | 52 } |
55 | 53 |
56 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() { | 54 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() { |
57 return CubicBezierTimingFunction::Create( | 55 return CubicBezierTimingFunction::Create(0.42, 0.0, 1.0, 1.0); |
58 0.42, 0.0, 1.0, 1.0).PassAs<TimingFunction>(); | |
59 } | 56 } |
60 | 57 |
61 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { | 58 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { |
62 return CubicBezierTimingFunction::Create( | 59 return CubicBezierTimingFunction::Create(0.0, 0.0, 0.58, 1.0); |
63 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); | |
64 } | 60 } |
65 | 61 |
66 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { | 62 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { |
67 return CubicBezierTimingFunction::Create( | 63 return CubicBezierTimingFunction::Create(0.42, 0.0, 0.58, 1); |
68 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); | |
69 } | 64 } |
70 | 65 |
71 } // namespace cc | 66 } // namespace cc |
OLD | NEW |