Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: cc/blink/web_transform_animation_curve_impl.cc

Issue 809523004: Define step timing function for the cc animation framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused enum Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/blink/web_transform_animation_curve_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 double x2, 46 double x2,
47 double y2) { 47 double y2) {
48 const cc::TransformOperations& transform_operations = 48 const cc::TransformOperations& transform_operations =
49 static_cast<const WebTransformOperationsImpl&>(keyframe.value()) 49 static_cast<const WebTransformOperationsImpl&>(keyframe.value())
50 .AsTransformOperations(); 50 .AsTransformOperations();
51 curve_->AddKeyframe(cc::TransformKeyframe::Create( 51 curve_->AddKeyframe(cc::TransformKeyframe::Create(
52 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations, 52 base::TimeDelta::FromSecondsD(keyframe.time()), 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::add(const WebTransformKeyframe& keyframe,
57 int steps,
58 float steps_start_offset) {
59 const cc::TransformOperations& transform_operations =
60 static_cast<const WebTransformOperationsImpl&>(keyframe.value())
61 .AsTransformOperations();
62 curve_->AddKeyframe(cc::TransformKeyframe::Create(
63 base::TimeDelta::FromSecondsD(keyframe.time()), transform_operations,
64 cc::StepsTimingFunction::Create(steps, steps_start_offset)));
65 }
66
56 void WebTransformAnimationCurveImpl::setTimingFunction( 67 void WebTransformAnimationCurveImpl::setTimingFunction(
57 TimingFunctionType type) { 68 TimingFunctionType type) {
58 curve_->SetTimingFunction(CreateTimingFunction(type)); 69 curve_->SetTimingFunction(CreateTimingFunction(type));
59 } 70 }
60 71
61 void WebTransformAnimationCurveImpl::setTimingFunction(double x1, 72 void WebTransformAnimationCurveImpl::setTimingFunction(double x1,
62 double y1, 73 double y1,
63 double x2, 74 double x2,
64 double y2) { 75 double y2) {
65 curve_->SetTimingFunction( 76 curve_->SetTimingFunction(
66 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); 77 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
67 } 78 }
68 79
69 scoped_ptr<cc::AnimationCurve> 80 scoped_ptr<cc::AnimationCurve>
70 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const { 81 WebTransformAnimationCurveImpl::CloneToAnimationCurve() const {
71 return curve_->Clone(); 82 return curve_->Clone();
72 } 83 }
73 84
74 } // namespace cc_blink 85 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_transform_animation_curve_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698