Remove --disable-app-shims.
[chromium-blink-merge.git] / cc / animation / timing_function.cc
blobbf11c20fe03a13f448f486ff600aef2005ea9d4c
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 "cc/animation/timing_function.h"
8 namespace cc {
10 TimingFunction::TimingFunction() {}
12 TimingFunction::~TimingFunction() {}
14 double TimingFunction::Duration() const {
15 return 1.0;
18 scoped_ptr<CubicBezierTimingFunction> CubicBezierTimingFunction::Create(
19 double x1, double y1, double x2, double y2) {
20 return make_scoped_ptr(new CubicBezierTimingFunction(x1, y1, x2, y2));
23 CubicBezierTimingFunction::CubicBezierTimingFunction(double x1,
24 double y1,
25 double x2,
26 double y2)
27 : bezier_(x1, y1, x2, y2) {}
29 CubicBezierTimingFunction::~CubicBezierTimingFunction() {}
31 float CubicBezierTimingFunction::GetValue(double x) const {
32 return static_cast<float>(bezier_.Solve(x));
35 scoped_ptr<AnimationCurve> CubicBezierTimingFunction::Clone() const {
36 return make_scoped_ptr(
37 new CubicBezierTimingFunction(*this)).PassAs<AnimationCurve>();
40 void CubicBezierTimingFunction::Range(float* min, float* max) const {
41 double min_d = 0;
42 double max_d = 1;
43 bezier_.Range(&min_d, &max_d);
44 *min = static_cast<float>(min_d);
45 *max = static_cast<float>(max_d);
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(
52 0.25, 0.1, 0.25, 1.0).PassAs<TimingFunction>();
55 scoped_ptr<TimingFunction> EaseInTimingFunction::Create() {
56 return CubicBezierTimingFunction::Create(
57 0.42, 0.0, 1.0, 1.0).PassAs<TimingFunction>();
60 scoped_ptr<TimingFunction> EaseOutTimingFunction::Create() {
61 return CubicBezierTimingFunction::Create(
62 0.0, 0.0, 0.58, 1.0).PassAs<TimingFunction>();
65 scoped_ptr<TimingFunction> EaseInOutTimingFunction::Create() {
66 return CubicBezierTimingFunction::Create(
67 0.42, 0.0, 0.58, 1).PassAs<TimingFunction>();
70 } // namespace cc