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 CompositorAnimation_h |
| 6 #define CompositorAnimation_h |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "platform/PlatformExport.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 |
| 12 namespace cc { |
| 13 class Animation; |
| 14 } |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class CompositorAnimationCurve; |
| 19 |
| 20 // A compositor driven animation. |
| 21 class PLATFORM_EXPORT CompositorAnimation { |
| 22 WTF_MAKE_NONCOPYABLE(CompositorAnimation); |
| 23 public: |
| 24 enum TargetProperty { |
| 25 TargetPropertyTransform, |
| 26 TargetPropertyOpacity, |
| 27 TargetPropertyFilter, |
| 28 TargetPropertyScrollOffset |
| 29 }; |
| 30 |
| 31 enum Direction { |
| 32 DirectionNormal, |
| 33 DirectionReverse, |
| 34 DirectionAlternate, |
| 35 DirectionAlternateReverse |
| 36 }; |
| 37 |
| 38 enum FillMode { |
| 39 FillModeNone, |
| 40 FillModeForwards, |
| 41 FillModeBackwards, |
| 42 FillModeBoth |
| 43 }; |
| 44 |
| 45 CompositorAnimation(const CompositorAnimationCurve&, TargetProperty, int ani
mationId, int groupId); |
| 46 virtual ~CompositorAnimation(); |
| 47 |
| 48 // An id must be unique. |
| 49 virtual int id(); |
| 50 virtual int group(); |
| 51 |
| 52 virtual TargetProperty targetProperty() const; |
| 53 |
| 54 // This is the number of times that the animation will play. If this |
| 55 // value is zero the animation will not play. If it is negative, then |
| 56 // the animation will loop indefinitely. |
| 57 virtual double iterations() const; |
| 58 virtual void setIterations(double); |
| 59 |
| 60 virtual double startTime() const; |
| 61 virtual void setStartTime(double monotonicTime); |
| 62 |
| 63 virtual double timeOffset() const; |
| 64 virtual void setTimeOffset(double monotonicTime); |
| 65 |
| 66 virtual Direction direction() const; |
| 67 virtual void setDirection(Direction); |
| 68 |
| 69 virtual double playbackRate() const; |
| 70 virtual void setPlaybackRate(double); |
| 71 |
| 72 virtual FillMode fillMode() const; |
| 73 virtual void setFillMode(FillMode); |
| 74 |
| 75 virtual double iterationStart() const; |
| 76 virtual void setIterationStart(double); |
| 77 |
| 78 scoped_ptr<cc::Animation> passAnimation(); |
| 79 |
| 80 // Removes ownership over cc animation. Identical to PassAnimation. |
| 81 // TODO(loyso): Erase this method. crbug.com/575041 |
| 82 cc::Animation* releaseCCAnimation(); |
| 83 |
| 84 protected: |
| 85 CompositorAnimation(); |
| 86 |
| 87 private: |
| 88 scoped_ptr<cc::Animation> m_animation; |
| 89 }; |
| 90 |
| 91 } // namespace blink |
| 92 |
| 93 #endif // CompositorAnimation_h |
OLD | NEW |