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 "cc/animation/timing_function.h" | 6 #include "cc/animation/timing_function.h" |
7 | 7 |
8 namespace cc { | 8 namespace cc { |
9 | 9 |
10 TimingFunction::TimingFunction() {} | 10 TimingFunction::TimingFunction() {} |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { | 64 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { |
65 return CubicBezierTimingFunction::Create( | 65 return CubicBezierTimingFunction::Create( |
66 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); | 66 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); |
67 } | 67 } |
68 | 68 |
69 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { | 69 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { |
70 return CubicBezierTimingFunction::Create( | 70 return CubicBezierTimingFunction::Create( |
71 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); | 71 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); |
72 } | 72 } |
73 | 73 |
| 74 scoped_ptr<StepsTimingFunction> StepsTimingFunction::Create( |
| 75 int steps, |
| 76 bool steps_at_start) { |
| 77 return make_scoped_ptr(new StepsTimingFunction(steps, steps_at_start)); |
| 78 } |
| 79 |
| 80 StepsTimingFunction::StepsTimingFunction(int steps, bool steps_at_start) |
| 81 : steps_(steps, steps_at_start) { |
| 82 } |
| 83 |
| 84 StepsTimingFunction::~StepsTimingFunction() { |
| 85 } |
| 86 |
| 87 float StepsTimingFunction::GetValue(double x) const { |
| 88 return static_cast<float>(steps_.Solve(x)); |
| 89 } |
| 90 |
| 91 scoped_ptr<AnimationCurve> StepsTimingFunction::Clone() const { |
| 92 return make_scoped_ptr(new StepsTimingFunction(*this)) |
| 93 .PassAs<AnimationCurve>(); |
| 94 } |
| 95 |
| 96 void StepsTimingFunction::Range(float* min, float* max) const { |
| 97 double min_d = 0; |
| 98 double max_d = 1; |
| 99 steps_.Range(&min_d, &max_d); |
| 100 *min = static_cast<float>(min_d); |
| 101 *max = static_cast<float>(max_d); |
| 102 } |
| 103 |
| 104 float StepsTimingFunction::Velocity(double x) const { |
| 105 return 0.0f; |
| 106 } |
| 107 |
74 } // namespace cc | 108 } // namespace cc |
OLD | NEW |