Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 UI_GFX_COMPOSITOR_LAYER_ANIMATION_SEQUENCE_H_ | |
| 6 #define UI_GFX_COMPOSITOR_LAYER_ANIMATION_SEQUENCE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/scoped_vector.h" | |
| 12 #include "base/time.h" | |
| 13 #include "ui/gfx/compositor/compositor_export.h" | |
| 14 #include "ui/gfx/compositor/layer_animation_element.h" | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 class LayerAnimationDelegate; | |
| 19 | |
| 20 // Contains a collection of layer animation elements to be played one after | |
| 21 // another. Although it has a similar interface to LayerAnimationElement, it is | |
| 22 // not a LayerAnimationElement (i.e., it is not permitted to have a sequence in | |
| 23 // a sequence). Sequences own their elements, and sequences are themselves owned | |
| 24 // by a LayerAnimator. | |
| 25 // | |
| 26 // TODO(vollick) Create a 'blended' sequence for transitioning between | |
| 27 // sequences. | |
| 28 class COMPOSITOR_EXPORT LayerAnimationSequence { | |
| 29 public: | |
| 30 typedef ScopedVector<LayerAnimationElement> Elements; | |
|
sky
2011/10/19 00:06:33
Move this to the private section.
| |
| 31 | |
| 32 LayerAnimationSequence(); | |
| 33 // Takes ownership of the given element and adds it to the sequence. | |
| 34 explicit LayerAnimationSequence(LayerAnimationElement* element); | |
| 35 virtual ~LayerAnimationSequence(); | |
| 36 | |
| 37 | |
|
sky
2011/10/19 00:06:33
remove one of these lines.
| |
| 38 // Updates the delegate to the appropriate value for |elapsed|, which is in | |
| 39 // the range [0, Duration()]. If the animation is not aborted, it is | |
| 40 // guaranteed that Animate will be called with elapsed = Duration(). | |
| 41 void Progress(base::TimeDelta elapsed, LayerAnimationDelegate* delegate); | |
| 42 | |
| 43 // Aborts the given animation. | |
| 44 void Abort(); | |
| 45 | |
| 46 // All properties modified by the sequence. | |
| 47 const LayerAnimationElement::AnimatableProperties& properties() const { | |
| 48 return properties_; | |
| 49 } | |
| 50 | |
| 51 // The total, finite duration of one cycle of the sequence. | |
| 52 base::TimeDelta duration() const { | |
| 53 return duration_; | |
| 54 } | |
| 55 | |
| 56 // Adds an element to the sequence. The sequences takes ownership of this | |
| 57 // element. | |
| 58 void AddElement(LayerAnimationElement* element); | |
| 59 | |
| 60 // Sequences can be looped indefinitely. | |
| 61 void set_is_cyclic(bool is_cyclic) { is_cyclic_ = is_cyclic; } | |
| 62 bool is_cyclic() const { return is_cyclic_; } | |
| 63 | |
| 64 // Returns true, if the sequences share a common property. | |
|
sky
2011/10/19 00:06:33
How about: returns true if this sequence has at le
| |
| 65 bool HasCommonProperty( | |
| 66 const LayerAnimationElement::AnimatableProperties& other) const; | |
| 67 | |
| 68 private: | |
| 69 base::TimeDelta duration_; | |
| 70 LayerAnimationElement::AnimatableProperties properties_; | |
|
sky
2011/10/19 00:06:33
Description?
| |
| 71 Elements elements_; | |
| 72 bool is_cyclic_; | |
| 73 | |
| 74 // these are used when animating to efficiently find the next element | |
| 75 Elements::size_type last_element_; | |
| 76 base::TimeDelta last_start_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(LayerAnimationSequence); | |
| 79 }; | |
| 80 | |
| 81 } // namespace ui | |
| 82 | |
| 83 #endif // UI_GFX_COMPOSITOR_LAYER_ANIMATION_SEQUENCE_H_ | |
| OLD | NEW |