Don't invoke Render() upon receipt of pause complete signal.
[chromium-blink-merge.git] / cc / animation / timing_function.cc
blob2531cc69f36457ccac33f807ad39ce960002f147
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
3 // found in the LICENSE file.
5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "cc/animation/timing_function.h"
9 namespace cc {
11 TimingFunction::TimingFunction() {}
13 TimingFunction::~TimingFunction() {}
15 scoped_ptr<CubicBezierTimingFunction> CubicBezierTimingFunction::Create(
16 double x1, double y1, double x2, double y2) {
17 return make_scoped_ptr(new CubicBezierTimingFunction(x1, y1, x2, y2));
20 CubicBezierTimingFunction::CubicBezierTimingFunction(double x1,
21 double y1,
22 double x2,
23 double y2)
24 : bezier_(x1, y1, x2, y2) {}
26 CubicBezierTimingFunction::~CubicBezierTimingFunction() {}
28 float CubicBezierTimingFunction::GetValue(double x) const {
29 return static_cast<float>(bezier_.Solve(x));
32 float CubicBezierTimingFunction::Velocity(double x) const {
33 return static_cast<float>(bezier_.Slope(x));
36 void CubicBezierTimingFunction::Range(float* min, float* max) const {
37 double min_d = 0;
38 double max_d = 1;
39 bezier_.Range(&min_d, &max_d);
40 *min = static_cast<float>(min_d);
41 *max = static_cast<float>(max_d);
44 scoped_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const {
45 return make_scoped_ptr(new CubicBezierTimingFunction(*this));
48 // These numbers come from
49 // http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag.
50 scoped_ptr<TimingFunction> EaseTimingFunction::Create() {
51 return CubicBezierTimingFunction::Create(0.25, 0.1, 0.25, 1.0);
54 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() {
55 return CubicBezierTimingFunction::Create(0.42, 0.0, 1.0, 1.0);
58 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() {
59 return CubicBezierTimingFunction::Create(0.0, 0.0, 0.58, 1.0);
62 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() {
63 return CubicBezierTimingFunction::Create(0.42, 0.0, 0.58, 1);
66 } // namespace cc