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

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

Issue 814853003: CC: Allow per-curve timing functions to be steps timing functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0
Patch Set: Rebase Created 5 years, 11 months 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
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_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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, 49 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
50 int steps, 50 int steps,
51 float steps_start_offset) { 51 float steps_start_offset) {
52 curve_->AddKeyframe(cc::FloatKeyframe::Create( 52 curve_->AddKeyframe(cc::FloatKeyframe::Create(
53 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value, 53 base::TimeDelta::FromSecondsD(keyframe.time), keyframe.value,
54 cc::StepsTimingFunction::Create(steps, steps_start_offset))); 54 cc::StepsTimingFunction::Create(steps, steps_start_offset)));
55 } 55 }
56 56
57 void WebFloatAnimationCurveImpl::setTimingFunction(TimingFunctionType type) { 57 void WebFloatAnimationCurveImpl::setLinearTimingFunction() {
58 curve_->SetTimingFunction(nullptr);
59 }
60
61 void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(
62 TimingFunctionType type) {
58 curve_->SetTimingFunction(CreateTimingFunction(type)); 63 curve_->SetTimingFunction(CreateTimingFunction(type));
59 } 64 }
60 65
61 void WebFloatAnimationCurveImpl::setTimingFunction(double x1, 66 void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
62 double y1, 67 double y1,
63 double x2, 68 double x2,
64 double y2) { 69 double y2) {
65 curve_->SetTimingFunction( 70 curve_->SetTimingFunction(
66 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass()); 71 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
67 } 72 }
68 73
74 void WebFloatAnimationCurveImpl::setStepsTimingFunction(
75 int number_of_steps,
76 float steps_start_offset) {
77 curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
78 number_of_steps, steps_start_offset).Pass());
79 }
80
69 float WebFloatAnimationCurveImpl::getValue(double time) const { 81 float WebFloatAnimationCurveImpl::getValue(double time) const {
70 return curve_->GetValue(base::TimeDelta::FromSecondsD(time)); 82 return curve_->GetValue(base::TimeDelta::FromSecondsD(time));
71 } 83 }
72 84
73 scoped_ptr<cc::AnimationCurve> 85 scoped_ptr<cc::AnimationCurve>
74 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { 86 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const {
75 return curve_->Clone(); 87 return curve_->Clone();
76 } 88 }
77 89
78 } // namespace cc_blink 90 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_float_animation_curve_impl.h ('k') | cc/blink/web_transform_animation_curve_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698