OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/blink/web_float_animation_curve_impl.h" | 5 #include "cc/blink/web_float_animation_curve_impl.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/timing_function.h" | 9 #include "cc/animation/timing_function.h" |
10 #include "cc/blink/web_animation_curve_common.h" | 10 #include "cc/blink/web_animation_curve_common.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, | 39 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
40 double x1, | 40 double x1, |
41 double y1, | 41 double y1, |
42 double x2, | 42 double x2, |
43 double y2) { | 43 double y2) { |
44 curve_->AddKeyframe(cc::FloatKeyframe::Create( | 44 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
45 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value, | 45 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value, |
46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); | 46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); |
47 } | 47 } |
48 | 48 |
| 49 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, |
| 50 int steps, |
| 51 float steps_start_offset) { |
| 52 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
| 53 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value, |
| 54 cc::StepsTimingFunction::Create(steps, steps_start_offset))); |
| 55 } |
| 56 |
49 void WebFloatAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { | 57 void WebFloatAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { |
50 curve_->SetTimingFunction(CreateTimingFunction(type)); | 58 curve_->SetTimingFunction(CreateTimingFunction(type)); |
51 } | 59 } |
52 | 60 |
53 void WebFloatAnimationCurveImpl::setTimingFunction(double x1, | 61 void WebFloatAnimationCurveImpl::setTimingFunction(double x1, |
54 double y1, | 62 double y1, |
55 double x2, | 63 double x2, |
56 double y2) { | 64 double y2) { |
57 curve_->SetTimingFunction( | 65 curve_->SetTimingFunction( |
58 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); | 66 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); |
59 } | 67 } |
60 | 68 |
61 float WebFloatAnimationCurveImpl::getValue(double time) const { | 69 float WebFloatAnimationCurveImpl::getValue(double time) const { |
62 return curve_->GetValue(base::TimeDelta::FromSecondsD(time)); | 70 return curve_->GetValue(base::TimeDelta::FromSecondsD(time)); |
63 } | 71 } |
64 | 72 |
65 scoped_ptr<cc::AnimationCurve> | 73 scoped_ptr<cc::AnimationCurve> |
66 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { | 74 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { |
67 return curve_->Clone(); | 75 return curve_->Clone(); |
68 } | 76 } |
69 | 77 |
70 } // namespace cc_blink | 78 } // namespace cc_blink |
OLD | NEW |