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

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

Issue 140253013: Define accelerated steps time function. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated patch: remove question about velocity Created 6 years, 3 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 18 matching lines...) Expand all
29 add(keyframe, TimingFunctionTypeEase); 29 add(keyframe, TimingFunctionTypeEase);
30 } 30 }
31 31
32 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, 32 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
33 TimingFunctionType type) { 33 TimingFunctionType type) {
34 curve_->AddKeyframe(cc::FloatKeyframe::Create( 34 curve_->AddKeyframe(cc::FloatKeyframe::Create(
35 keyframe.time, keyframe.value, CreateTimingFunction(type))); 35 keyframe.time, keyframe.value, CreateTimingFunction(type)));
36 } 36 }
37 37
38 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, 38 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
39 int steps,
40 bool steps_at_start) {
41 curve_->AddKeyframe(cc::FloatKeyframe::Create(
42 keyframe.time,
43 keyframe.value,
44 cc::StepsTimingFunction::Create(steps, steps_at_start)
45 .PassAs<cc::TimingFunction>()));
46 }
47
48 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
39 double x1, 49 double x1,
40 double y1, 50 double y1,
41 double x2, 51 double x2,
42 double y2) { 52 double y2) {
43 curve_->AddKeyframe(cc::FloatKeyframe::Create( 53 curve_->AddKeyframe(cc::FloatKeyframe::Create(
44 keyframe.time, 54 keyframe.time,
45 keyframe.value, 55 keyframe.value,
46 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2) 56 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)
47 .PassAs<cc::TimingFunction>())); 57 .PassAs<cc::TimingFunction>()));
48 } 58 }
49 59
50 float WebFloatAnimationCurveImpl::getValue(double time) const { 60 float WebFloatAnimationCurveImpl::getValue(double time) const {
51 return curve_->GetValue(time); 61 return curve_->GetValue(time);
52 } 62 }
53 63
54 scoped_ptr<cc::AnimationCurve> 64 scoped_ptr<cc::AnimationCurve>
55 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const { 65 WebFloatAnimationCurveImpl::CloneToAnimationCurve() const {
56 return curve_->Clone(); 66 return curve_->Clone();
57 } 67 }
58 68
59 } // namespace cc_blink 69 } // 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