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

Side by Side Diff: third_party/WebKit/Source/platform/animation/CompositorTransformAnimationCurve.cpp

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix copyrights and years. Created 4 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
(Empty)
1 // Copyright 2016 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 "platform/animation/CompositorTransformAnimationCurve.h"
6
7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/animation/timing_function.h"
9 #include "cc/animation/transform_operations.h"
10 #include "platform/animation/CompositorTransformOperations.h"
11
12 using blink::CompositorTransformKeyframe;
13
14 namespace blink {
15
16 CompositorTransformAnimationCurve::CompositorTransformAnimationCurve()
17 : m_curve(cc::KeyframedTransformAnimationCurve::Create())
18 {
19 }
20
21 CompositorTransformAnimationCurve::~CompositorTransformAnimationCurve()
22 {
23 }
24
25 CompositorAnimationCurve::AnimationCurveType CompositorTransformAnimationCurve:: type() const
26 {
27 return CompositorAnimationCurve::AnimationCurveTypeTransform;
28 }
29
30 void CompositorTransformAnimationCurve::add(const CompositorTransformKeyframe& k eyframe)
31 {
32 add(keyframe, TimingFunctionTypeEase);
33 }
34
35 void CompositorTransformAnimationCurve::add(const CompositorTransformKeyframe& k eyframe, TimingFunctionType type)
36 {
37 const cc::TransformOperations& transformOperations = keyframe.value().asTran sformOperations();
38 m_curve->AddKeyframe(cc::TransformKeyframe::Create(
39 base::TimeDelta::FromSecondsD(keyframe.time()), transformOperations,
40 createTimingFunction(type)));
41 }
42
43 void CompositorTransformAnimationCurve::add(const CompositorTransformKeyframe& k eyframe, double x1, double y1, double x2, double y2)
44 {
45 const cc::TransformOperations& transformOperations = keyframe.value().asTran sformOperations();
46 m_curve->AddKeyframe(cc::TransformKeyframe::Create(
47 base::TimeDelta::FromSecondsD(keyframe.time()), transformOperations,
48 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)));
49 }
50
51 void CompositorTransformAnimationCurve::add(const CompositorTransformKeyframe& k eyframe, int steps, float stepsStartOffset)
52 {
53 const cc::TransformOperations& transformOperations = keyframe.value().asTran sformOperations();
54 m_curve->AddKeyframe(cc::TransformKeyframe::Create(
55 base::TimeDelta::FromSecondsD(keyframe.time()), transformOperations,
56 cc::StepsTimingFunction::Create(steps, stepsStartOffset)));
57 }
58
59 void CompositorTransformAnimationCurve::setLinearTimingFunction()
60 {
61 m_curve->SetTimingFunction(nullptr);
62 }
63
64 void CompositorTransformAnimationCurve::setCubicBezierTimingFunction(TimingFunct ionType type)
65 {
66 m_curve->SetTimingFunction(createTimingFunction(type));
67 }
68
69 void CompositorTransformAnimationCurve::setCubicBezierTimingFunction(double x1, double y1, double x2, double y2)
70 {
71 m_curve->SetTimingFunction(
72 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2));
73 }
74
75 void CompositorTransformAnimationCurve::setStepsTimingFunction(int numberOfSteps , float stepsStartOffset)
76 {
77 m_curve->SetTimingFunction(cc::StepsTimingFunction::Create(numberOfSteps, st epsStartOffset));
78 }
79
80 scoped_ptr<cc::AnimationCurve> CompositorTransformAnimationCurve::cloneToAnimati onCurve() const
81 {
82 return m_curve->Clone();
83 }
84
85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698