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

Side by Side Diff: third_party/WebKit/Source/platform/animation/WebTransformAnimationCurve.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: Fix ScrollAnimatorCompositorCoordinator for MSVC. 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/WebTransformAnimationCurve.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/WebTransformOperations.h"
11
12 using blink::WebTransformKeyframe;
13
14 namespace blink {
15
16 WebTransformAnimationCurve::WebTransformAnimationCurve()
17 : m_curve(cc::KeyframedTransformAnimationCurve::Create())
18 {
19 }
20
21 WebTransformAnimationCurve::~WebTransformAnimationCurve()
22 {
23 }
24
25 WebCompositorAnimationCurve::AnimationCurveType WebTransformAnimationCurve::type () const
26 {
27 return WebCompositorAnimationCurve::AnimationCurveTypeTransform;
28 }
29
30 void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe)
31 {
32 add(keyframe, TimingFunctionTypeEase);
33 }
34
35 void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe, Timin gFunctionType 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 WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe,
44 double x1,
45 double y1,
46 double x2,
47 double y2)
48 {
49 const cc::TransformOperations& transformOperations = keyframe.value().AsTran sformOperations();
50 m_curve->AddKeyframe(cc::TransformKeyframe::Create(
51 base::TimeDelta::FromSecondsD(keyframe.time()), transformOperations,
52 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)));
53 }
54
55 void WebTransformAnimationCurve::add(const WebTransformKeyframe& keyframe,
56 int steps,
57 float stepsStartOffset)
58 {
59 const cc::TransformOperations& transformOperations = keyframe.value().AsTran sformOperations();
60 m_curve->AddKeyframe(cc::TransformKeyframe::Create(
61 base::TimeDelta::FromSecondsD(keyframe.time()), transformOperations,
62 cc::StepsTimingFunction::Create(steps, stepsStartOffset)));
63 }
64
65 void WebTransformAnimationCurve::setLinearTimingFunction()
66 {
67 m_curve->SetTimingFunction(nullptr);
68 }
69
70 void WebTransformAnimationCurve::setCubicBezierTimingFunction(TimingFunctionType type)
71 {
72 m_curve->SetTimingFunction(CreateTimingFunction(type));
73 }
74
75 void WebTransformAnimationCurve::setCubicBezierTimingFunction(double x1,
76 double y1,
77 double x2,
78 double y2)
79 {
80 m_curve->SetTimingFunction(
81 cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2));
82 }
83
84 void WebTransformAnimationCurve::setStepsTimingFunction(
85 int numberOfSteps,
86 float stepsStartOffset)
87 {
88 m_curve->SetTimingFunction(
89 cc::StepsTimingFunction::Create(numberOfSteps, stepsStartOffset));
90 }
91
92 scoped_ptr<cc::AnimationCurve> WebTransformAnimationCurve::CloneToAnimationCurve () const
93 {
94 return m_curve->Clone();
95 }
96
97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698