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 18 matching lines...) Expand all Loading... |
29 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { | 29 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) { |
30 add(keyframe, TimingFunctionTypeEase); | 30 add(keyframe, TimingFunctionTypeEase); |
31 } | 31 } |
32 | 32 |
33 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 33 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
34 TimingFunctionType type) { | 34 TimingFunctionType type) { |
35 const cc::TransformOperations& transform_operations = | 35 const cc::TransformOperations& transform_operations = |
36 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) | 36 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) |
37 .AsTransformOperations(); | 37 .AsTransformOperations(); |
38 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 38 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
39 keyframe.time(), transform_operations, CreateTimingFunction(type))); | 39 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations, |
| 40 CreateTimingFunction(type))); |
40 } | 41 } |
41 | 42 |
42 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, | 43 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, |
43 double x1, | 44 double x1, |
44 double y1, | 45 double y1, |
45 double x2, | 46 double x2, |
46 double y2) { | 47 double y2) { |
47 const cc::TransformOperations& transform_operations = | 48 const cc::TransformOperations& transform_operations = |
48 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) | 49 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) |
49 .AsTransformOperations(); | 50 .AsTransformOperations(); |
50 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 51 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
51 keyframe.time(), | 52 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations, |
52 transform_operations, | |
53 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); | 53 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2))); |
54 } | 54 } |
55 | 55 |
56 void WebTransformAnimationCurveImpl::setTimingFunction( | 56 void WebTransformAnimationCurveImpl::setTimingFunction( |
57 TimingFunctionType type) { | 57 TimingFunctionType type) { |
58 curve_->SetTimingFunction(CreateTimingFunction(type)); | 58 curve_->SetTimingFunction(CreateTimingFunction(type)); |
59 } | 59 } |
60 | 60 |
61 void WebTransformAnimationCurveImpl::setTimingFunction(double x1, | 61 void WebTransformAnimationCurveImpl::setTimingFunction(double x1, |
62 double y1, | 62 double y1, |
63 double x2, | 63 double x2, |
64 double y2) { | 64 double y2) { |
65 curve_->SetTimingFunction( | 65 curve_->SetTimingFunction( |
66 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); | 66 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); |
67 } | 67 } |
68 | 68 |
69 scoped_ptr<cc::AnimationCurve> | 69 scoped_ptr<cc::AnimationCurve> |
70 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { | 70 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { |
71 return curve_->Clone(); | 71 return curve_->Clone(); |
72 } | 72 } |
73 | 73 |
74 } // namespace cc_blink | 74 } // namespace cc_blink |
OLD | NEW |