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

Side by Side Diff: cc/animation/timing_function.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
« no previous file with comments | « cc/animation/timing_function.h ('k') | cc/blink/web_filter_animation_curve_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "cc/animation/timing_function.h" 6 #include "cc/animation/timing_function.h"
7 7
8 namespace cc { 8 namespace cc {
9 9
10 TimingFunction::TimingFunction() {} 10 TimingFunction::TimingFunction() {}
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { 64 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() {
65 return CubicBezierTimingFunction::Create( 65 return CubicBezierTimingFunction::Create(
66 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); 66 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>();
67 } 67 }
68 68
69 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { 69 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() {
70 return CubicBezierTimingFunction::Create( 70 return CubicBezierTimingFunction::Create(
71 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); 71 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>();
72 } 72 }
73 73
74 scoped_ptr<StepsTimingFunction> StepsTimingFunction::Create(
75 int steps,
76 bool steps_at_start) {
77 return make_scoped_ptr(new StepsTimingFunction(steps, steps_at_start));
78 }
79
80 StepsTimingFunction::StepsTimingFunction(int steps, bool steps_at_start)
81 : steps_(steps, steps_at_start) {
82 }
83
84 StepsTimingFunction::~StepsTimingFunction() {
85 }
86
87 float StepsTimingFunction::GetValue(double x) const {
88 return static_cast<float>(steps_.Solve(x));
89 }
90
91 scoped_ptr<AnimationCurve> StepsTimingFunction::Clone() const {
92 return make_scoped_ptr(new StepsTimingFunction(*this))
93 .PassAs<AnimationCurve>();
94 }
95
96 void StepsTimingFunction::Range(float* min, float* max) const {
97 double min_d = 0;
98 double max_d = 1;
99 steps_.Range(&min_d, &max_d);
100 *min = static_cast<float>(min_d);
101 *max = static_cast<float>(max_d);
102 }
103
104 float StepsTimingFunction::Velocity(double x) const {
105 return 0.0f;
106 }
107
74 } // namespace cc 108 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/timing_function.h ('k') | cc/blink/web_filter_animation_curve_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698