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 29 matching lines...) Expand all Loading... |
40 double y1, | 40 double y1, |
41 double x2, | 41 double x2, |
42 double y2) { | 42 double y2) { |
43 curve_->AddKeyframe(cc::FloatKeyframe::Create( | 43 curve_->AddKeyframe(cc::FloatKeyframe::Create( |
44 keyframe.time, | 44 keyframe.time, |
45 keyframe.value, | 45 keyframe.value, |
46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) | 46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) |
47 .PassAs<cc::TimingFunction>())); | 47 .PassAs<cc::TimingFunction>())); |
48 } | 48 } |
49 | 49 |
| 50 #if WEB_ANIMATION_SUPPORTS_ANIMATION_TIMING |
| 51 void WebFloatAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { |
| 52 curve_->SetTimingFunction(CreateTimingFunction(type)); |
| 53 } |
| 54 |
| 55 void WebFloatAnimationCurveImpl::setTimingFunction(double x1, |
| 56 double y1, |
| 57 double x2, |
| 58 double y2) { |
| 59 curve_->SetTimingFunction(cc::CubicBezierTimingFunction::Create( |
| 60 x1, y1, x2, y2).PassAs<cc::TimingFunction>()); |
| 61 } |
| 62 #endif |
| 63 |
50 float WebFloatAnimationCurveImpl::getValue(double time) const { | 64 float WebFloatAnimationCurveImpl::getValue(double time) const { |
51 return curve_->GetValue(time); | 65 return curve_->GetValue(time); |
52 } | 66 } |
53 | 67 |
54 scoped_ptr<cc::AnimationCurve> | 68 scoped_ptr<cc::AnimationCurve> |
55 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { | 69 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { |
56 return curve_->Clone(); | 70 return curve_->Clone(); |
57 } | 71 } |
58 | 72 |
59 } // namespace cc_blink | 73 } // namespace cc_blink |
OLD | NEW |