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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int steps, | 57 int steps, |
58 float steps_start_offset) { | 58 float steps_start_offset) { |
59 const cc::TransformOperations& transform_operations = | 59 const cc::TransformOperations& transform_operations = |
60 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) | 60 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) |
61 .AsTransformOperations(); | 61 .AsTransformOperations(); |
62 curve_->AddKeyframe(cc::TransformKeyframe::Create( | 62 curve_->AddKeyframe(cc::TransformKeyframe::Create( |
63 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations, | 63 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations, |
64 cc::StepsTimingFunction::Create(steps, steps_start_offset))); | 64 cc::StepsTimingFunction::Create(steps, steps_start_offset))); |
65 } | 65 } |
66 | 66 |
67 void WebTransformAnimationCurveImpl::setTimingFunction( | 67 void WebTransformAnimationCurveImpl::setLinearTimingFunction() { |
| 68 curve_->SetTimingFunction(nullptr); |
| 69 } |
| 70 |
| 71 void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction( |
68 TimingFunctionType type) { | 72 TimingFunctionType type) { |
69 curve_->SetTimingFunction(CreateTimingFunction(type)); | 73 curve_->SetTimingFunction(CreateTimingFunction(type)); |
70 } | 74 } |
71 | 75 |
72 void WebTransformAnimationCurveImpl::setTimingFunction(double x1, | 76 void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction(double x1, |
73 double y1, | 77 double y1, |
74 double x2, | 78 double x2, |
75 double y2) { | 79 double y2) { |
76 curve_->SetTimingFunction( | 80 curve_->SetTimingFunction( |
77 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); | 81 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); |
78 } | 82 } |
79 | 83 |
| 84 void WebTransformAnimationCurveImpl::setStepsTimingFunction( |
| 85 int number_of_steps, |
| 86 float steps_start_offset) { |
| 87 curve_->SetTimingFunction(cc::StepsTimingFunction::Create( |
| 88 number_of_steps, steps_start_offset).Pass()); |
| 89 } |
| 90 |
80 scoped_ptr<cc::AnimationCurve> | 91 scoped_ptr<cc::AnimationCurve> |
81 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { | 92 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { |
82 return curve_->Clone(); | 93 return curve_->Clone(); |
83 } | 94 } |
84 | 95 |
85 } // namespace cc_blink | 96 } // namespace cc_blink |
OLD | NEW |