OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebCompositorAnimation_h | 5 #ifndef WebCompositorAnimation_h |
6 #define WebCompositorAnimation_h | 6 #define WebCompositorAnimation_h |
7 | 7 |
8 #define WEB_ANIMATION_SUPPORTS_FRACTIONAL_ITERATIONS 1 | 8 #define WEB_ANIMATION_SUPPORTS_FRACTIONAL_ITERATIONS 1 |
| 9 #define WEB_ANIMATION_SUPPORTS_FULL_DIRECTION 1 |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 // A compositor driven animation. | 13 // A compositor driven animation. |
13 class WebCompositorAnimation { | 14 class WebCompositorAnimation { |
14 public: | 15 public: |
15 enum TargetProperty { | 16 enum TargetProperty { |
16 TargetPropertyTransform = 0, | 17 TargetPropertyTransform = 0, |
17 TargetPropertyOpacity, | 18 TargetPropertyOpacity, |
18 TargetPropertyFilter, | 19 TargetPropertyFilter, |
19 TargetPropertyScrollOffset | 20 TargetPropertyScrollOffset |
20 }; | 21 }; |
21 | 22 |
| 23 enum Direction { |
| 24 DirectionNormal = 0, |
| 25 DirectionReverse, |
| 26 DirectionAlternate, |
| 27 DirectionAlternateReverse |
| 28 }; |
| 29 |
22 virtual ~WebCompositorAnimation() { } | 30 virtual ~WebCompositorAnimation() { } |
23 | 31 |
24 // An id is effectively the animation's name, and it is not unique. | 32 // An id is effectively the animation's name, and it is not unique. |
25 virtual int id() = 0; | 33 virtual int id() = 0; |
26 | 34 |
27 virtual TargetProperty targetProperty() const = 0; | 35 virtual TargetProperty targetProperty() const = 0; |
28 | 36 |
29 // This is the number of times that the animation will play. If this | 37 // This is the number of times that the animation will play. If this |
30 // value is zero the animation will not play. If it is negative, then | 38 // value is zero the animation will not play. If it is negative, then |
31 // the animation will loop indefinitely. | 39 // the animation will loop indefinitely. |
32 virtual double iterations() const = 0; | 40 virtual double iterations() const = 0; |
33 virtual void setIterations(double) = 0; | 41 virtual void setIterations(double) = 0; |
34 | 42 |
35 virtual double startTime() const = 0; | 43 virtual double startTime() const = 0; |
36 virtual void setStartTime(double monotonicTime) = 0; | 44 virtual void setStartTime(double monotonicTime) = 0; |
37 | 45 |
38 virtual double timeOffset() const = 0; | 46 virtual double timeOffset() const = 0; |
39 virtual void setTimeOffset(double monotonicTime) = 0; | 47 virtual void setTimeOffset(double monotonicTime) = 0; |
40 | 48 |
41 // If alternatesDirection is true, on odd numbered iterations we reverse the
curve. | 49 virtual Direction direction() const = 0; |
42 virtual bool alternatesDirection() const = 0; | 50 virtual void setDirection(Direction) = 0; |
43 virtual void setAlternatesDirection(bool) = 0; | |
44 }; | 51 }; |
45 | 52 |
46 } // namespace blink | 53 } // namespace blink |
47 | 54 |
48 #endif // WebCompositorAnimation_h | 55 #endif // WebCompositorAnimation_h |
OLD | NEW |