| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "config.h" | |
| 6 | |
| 7 #include "WebFloatAnimationCurveImpl.h" | |
| 8 | |
| 9 #include "WebAnimationCurveCommon.h" | |
| 10 #include "cc/animation_curve.h" | |
| 11 #include "cc/keyframed_animation_curve.h" | |
| 12 #include "cc/timing_function.h" | |
| 13 | |
| 14 namespace WebKit { | |
| 15 | |
| 16 WebFloatAnimationCurve* WebFloatAnimationCurve::create() | |
| 17 { | |
| 18 return new WebFloatAnimationCurveImpl(); | |
| 19 } | |
| 20 | |
| 21 WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() | |
| 22 : m_curve(cc::CCKeyframedFloatAnimationCurve::create()) | |
| 23 { | |
| 24 } | |
| 25 | |
| 26 WebFloatAnimationCurveImpl::~WebFloatAnimationCurveImpl() | |
| 27 { | |
| 28 } | |
| 29 | |
| 30 WebAnimationCurve::AnimationCurveType WebFloatAnimationCurveImpl::type() const | |
| 31 { | |
| 32 return WebAnimationCurve::AnimationCurveTypeFloat; | |
| 33 } | |
| 34 | |
| 35 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe) | |
| 36 { | |
| 37 add(keyframe, TimingFunctionTypeEase); | |
| 38 } | |
| 39 | |
| 40 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, TimingFun
ctionType type) | |
| 41 { | |
| 42 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, createTimingFunction(type))); | |
| 43 } | |
| 44 | |
| 45 void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe, double x1
, double y1, double x2, double y2) | |
| 46 { | |
| 47 m_curve->addKeyframe(cc::CCFloatKeyframe::create(keyframe.time, keyframe.val
ue, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTimingF
unction>())); | |
| 48 } | |
| 49 | |
| 50 float WebFloatAnimationCurveImpl::getValue(double time) const | |
| 51 { | |
| 52 return m_curve->getValue(time); | |
| 53 } | |
| 54 | |
| 55 scoped_ptr<cc::CCAnimationCurve> WebFloatAnimationCurveImpl::cloneToCCAnimationC
urve() const | |
| 56 { | |
| 57 return m_curve->clone(); | |
| 58 } | |
| 59 | |
| 60 } // namespace WebKit | |
| OLD | NEW |