| 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 "WebTransformAnimationCurveImpl.h" | |
| 8 | |
| 9 #include "WebAnimationCurveCommon.h" | |
| 10 #include "cc/keyframed_animation_curve.h" | |
| 11 #include "cc/timing_function.h" | |
| 12 | |
| 13 namespace WebKit { | |
| 14 | |
| 15 WebTransformAnimationCurve* WebTransformAnimationCurve::create() | |
| 16 { | |
| 17 return new WebTransformAnimationCurveImpl(); | |
| 18 } | |
| 19 | |
| 20 WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() | |
| 21 : m_curve(cc::CCKeyframedTransformAnimationCurve::create()) | |
| 22 { | |
| 23 } | |
| 24 | |
| 25 WebTransformAnimationCurveImpl::~WebTransformAnimationCurveImpl() | |
| 26 { | |
| 27 } | |
| 28 | |
| 29 WebAnimationCurve::AnimationCurveType WebTransformAnimationCurveImpl::type() con
st | |
| 30 { | |
| 31 return WebAnimationCurve::AnimationCurveTypeTransform; | |
| 32 } | |
| 33 | |
| 34 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe) | |
| 35 { | |
| 36 add(keyframe, TimingFunctionTypeEase); | |
| 37 } | |
| 38 | |
| 39 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, T
imingFunctionType type) | |
| 40 { | |
| 41 m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe
.value, createTimingFunction(type))); | |
| 42 } | |
| 43 | |
| 44 void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe, d
ouble x1, double y1, double x2, double y2) | |
| 45 { | |
| 46 m_curve->addKeyframe(cc::CCTransformKeyframe::create(keyframe.time, keyframe
.value, cc::CCCubicBezierTimingFunction::create(x1, y1, x2, y2).PassAs<cc::CCTim
ingFunction>())); | |
| 47 } | |
| 48 | |
| 49 WebTransformationMatrix WebTransformAnimationCurveImpl::getValue(double time) co
nst | |
| 50 { | |
| 51 return m_curve->getValue(time); | |
| 52 } | |
| 53 | |
| 54 scoped_ptr<cc::CCAnimationCurve> WebTransformAnimationCurveImpl::cloneToCCAnimat
ionCurve() const | |
| 55 { | |
| 56 return m_curve->clone(); | |
| 57 } | |
| 58 | |
| 59 } // namespace WebKit | |
| OLD | NEW |