OLD | NEW |
(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 #ifndef CompositorFloatAnimationCurve_h |
| 6 #define CompositorFloatAnimationCurve_h |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "platform/PlatformExport.h" |
| 10 #include "platform/animation/CompositorAnimationCurve.h" |
| 11 #include "platform/animation/CompositorFloatKeyframe.h" |
| 12 #include "wtf/Noncopyable.h" |
| 13 |
| 14 namespace cc { |
| 15 class AnimationCurve; |
| 16 class KeyframedFloatAnimationCurve; |
| 17 } |
| 18 |
| 19 namespace blink { |
| 20 struct CompositorFloatKeyframe; |
| 21 } |
| 22 |
| 23 namespace blink { |
| 24 |
| 25 // A keyframed float animation curve. |
| 26 class PLATFORM_EXPORT CompositorFloatAnimationCurve : public CompositorAnimation
Curve { |
| 27 WTF_MAKE_NONCOPYABLE(CompositorFloatAnimationCurve); |
| 28 public: |
| 29 CompositorFloatAnimationCurve(); |
| 30 ~CompositorFloatAnimationCurve() override; |
| 31 |
| 32 // Adds the keyframe with the default timing function (ease). |
| 33 virtual void add(const CompositorFloatKeyframe&); |
| 34 virtual void add(const CompositorFloatKeyframe&, TimingFunctionType); |
| 35 // Adds the keyframe with a custom, bezier timing function. Note, it is |
| 36 // assumed that x0 = y0 , and x3 = y3 = 1. |
| 37 virtual void add(const CompositorFloatKeyframe&, double x1, double y1, doubl
e x2, double y2); |
| 38 // Adds the keyframe with a steps timing function. |
| 39 virtual void add(const CompositorFloatKeyframe&, int steps, float stepsStart
Offset); |
| 40 |
| 41 virtual void setLinearTimingFunction(); |
| 42 virtual void setCubicBezierTimingFunction(TimingFunctionType); |
| 43 virtual void setCubicBezierTimingFunction(double x1, double y1, double x2, d
ouble y2); |
| 44 virtual void setStepsTimingFunction(int numberOfSteps, float stepsStartOffse
t); |
| 45 |
| 46 virtual float getValue(double time) const; |
| 47 |
| 48 // CompositorAnimationCurve implementation. |
| 49 AnimationCurveType type() const override; |
| 50 |
| 51 scoped_ptr<cc::AnimationCurve> cloneToAnimationCurve() const; |
| 52 |
| 53 private: |
| 54 scoped_ptr<cc::KeyframedFloatAnimationCurve> m_curve; |
| 55 }; |
| 56 |
| 57 } // namespace blink |
| 58 |
| 59 #endif // CompositorFloatAnimationCurve_h |
OLD | NEW |