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

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: new patch Created 6 years, 10 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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() { 60 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() {
61 return CubicBezierTimingFunction::Create( 61 return CubicBezierTimingFunction::Create(
62 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>(); 62 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>();
63 } 63 }
64 64
65 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() { 65 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() {
66 return CubicBezierTimingFunction::Create( 66 return CubicBezierTimingFunction::Create(
67 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>(); 67 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>();
68 } 68 }
69 69
70 scoped_ptr<StepsTimingFunction> StepsTimingFunction::Create(
71 int steps, bool steps_at_start) {
72 return make_scoped_ptr(new StepsTimingFunction(steps, steps_at_start));
73 }
74
75 StepsTimingFunction::StepsTimingFunction(int steps,
76 bool steps_at_start)
77 : steps_(steps, steps_at_start) {}
78
79 StepsTimingFunction::~StepsTimingFunction() {}
80
81 float StepsTimingFunction::GetValue(double x) const {
82 return static_cast<float>(steps_.Solve(x));
83 }
84
85 scoped_ptr<AnimationCurve> StepsTimingFunction::Clone() const {
86 return make_scoped_ptr(
87 new StepsTimingFunction(*this)).PassAs<AnimationCurve>();
88 }
89
90 void StepsTimingFunction::Range(float* min, float* max) const {
91 double min_d = 0;
92 double max_d = 1;
93 steps_.Range(&min_d, &max_d);
94 *min = static_cast<float>(min_d);
95 *max = static_cast<float>(max_d);
96 }
97
70 } // namespace cc 98 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698