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_transform_animation_curve_impl.h" | 5 #include "cc/blink/web_transform_animation_curve_impl.h" |
6 | 6 |
7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/animation/timing_function.h" | 8 #include "cc/animation/timing_function.h" |
9 #include "cc/animation/transform_operations.h" | 9 #include "cc/animation/transform_operations.h" |
10 #include "cc/blink/web_animation_curve_common.h" | 10 #include "cc/blink/web_animation_curve_common.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const cc::TransformOperations& transform_operations = | 47 const cc::TransformOperations& transform_operations = |
48 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) | 48 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) |
49 .AsTransformOperations(); | 49 .AsTransformOperations(); |
50 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 50 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
51 keyframe.time(), | 51 keyframe.time(), |
52 transform_operations, | 52 transform_operations, |
53 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) | 53 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) |
54 .PassAs<cc::TimingFunction>())); | 54 .PassAs<cc::TimingFunction>())); |
55 } | 55 } |
56 | 56 |
| 57 #if WEB_ANIMATION_SUPPORTS_ANIMATION_TIMING |
| 58 void WebTransformAnimationCurveImpl::setTimingFunction( |
| 59 TimingFunctionType type) { |
| 60 curve_->SetTimingFunction(CreateTimingFunction(type)); |
| 61 } |
| 62 |
| 63 void WebTransformAnimationCurveImpl::setTimingFunction(double x1, |
| 64 double y1, |
| 65 double x2, |
| 66 double y2) { |
| 67 curve_->SetTimingFunction(cc::CubicBezierTimingFunction::Create( |
| 68 x1, y1, x2, y2).PassAs<cc::TimingFunction>()); |
| 69 } |
| 70 #endif |
| 71 |
57 scoped_ptr<cc::AnimationCurve> | 72 scoped_ptr<cc::AnimationCurve> |
58 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { | 73 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { |
59 return curve_->Clone(); | 74 return curve_->Clone(); |
60 } | 75 } |
61 | 76 |
62 } // namespace cc_blink | 77 } // namespace cc_blink |
OLD | NEW |