| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 UI_BASE_ANIMATION_MULTI_ANIMATION_H_ | 5 #ifndef UI_BASE_ANIMATION_MULTI_ANIMATION_H_ |
| 6 #define UI_BASE_ANIMATION_MULTI_ANIMATION_H_ | 6 #define UI_BASE_ANIMATION_MULTI_ANIMATION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 explicit MultiAnimation(const Parts& parts); | 49 explicit MultiAnimation(const Parts& parts); |
| 50 virtual ~MultiAnimation(); | 50 virtual ~MultiAnimation(); |
| 51 | 51 |
| 52 // Sets whether the animation continues after it reaches the end. If true, the | 52 // Sets whether the animation continues after it reaches the end. If true, the |
| 53 // animation runs until explicitly stopped. The default is true. | 53 // animation runs until explicitly stopped. The default is true. |
| 54 void set_continuous(bool continuous) { continuous_ = continuous; } | 54 void set_continuous(bool continuous) { continuous_ = continuous; } |
| 55 | 55 |
| 56 // Returns the current value. The current value for a MultiAnimation is | 56 // Returns the current value. The current value for a MultiAnimation is |
| 57 // determined from the tween type of the current part. | 57 // determined from the tween type of the current part. |
| 58 virtual double GetCurrentValue() const; | 58 virtual double GetCurrentValue() const OVERRIDE; |
| 59 | 59 |
| 60 // Returns the index of the current part. | 60 // Returns the index of the current part. |
| 61 size_t current_part_index() const { return current_part_index_; } | 61 size_t current_part_index() const { return current_part_index_; } |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 // Animation overrides. | 64 // Animation overrides. |
| 65 virtual void Step(base::TimeTicks time_now); | 65 virtual void Step(base::TimeTicks time_now) OVERRIDE; |
| 66 virtual void SetStartTime(base::TimeTicks start_time); | 66 virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // Returns the part containing the specified time. |time_ms| is reset to be | 69 // Returns the part containing the specified time. |time_ms| is reset to be |
| 70 // relative to the part containing the time and |part_index| the index of the | 70 // relative to the part containing the time and |part_index| the index of the |
| 71 // part. | 71 // part. |
| 72 const Part& GetPart(int* time_ms, size_t* part_index); | 72 const Part& GetPart(int* time_ms, size_t* part_index); |
| 73 | 73 |
| 74 // The parts that make up the animation. | 74 // The parts that make up the animation. |
| 75 const Parts parts_; | 75 const Parts parts_; |
| 76 | 76 |
| 77 // Total time of all the parts. | 77 // Total time of all the parts. |
| 78 const int cycle_time_ms_; | 78 const int cycle_time_ms_; |
| 79 | 79 |
| 80 // Current value for the animation. | 80 // Current value for the animation. |
| 81 double current_value_; | 81 double current_value_; |
| 82 | 82 |
| 83 // Index of the current part. | 83 // Index of the current part. |
| 84 size_t current_part_index_; | 84 size_t current_part_index_; |
| 85 | 85 |
| 86 // See description above setter. | 86 // See description above setter. |
| 87 bool continuous_; | 87 bool continuous_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(MultiAnimation); | 89 DISALLOW_COPY_AND_ASSIGN(MultiAnimation); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace ui | 92 } // namespace ui |
| 93 | 93 |
| 94 #endif // UI_BASE_ANIMATION_MULTI_ANIMATION_H_ | 94 #endif // UI_BASE_ANIMATION_MULTI_ANIMATION_H_ |
| OLD | NEW |