Chromium Code Reviews| 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_GFX_ANIMATION_LINEAR_ANIMATION_H_ | 5 #ifndef UI_GFX_ANIMATION_LINEAR_ANIMATION_H_ |
| 6 #define UI_GFX_ANIMATION_LINEAR_ANIMATION_H_ | 6 #define UI_GFX_ANIMATION_LINEAR_ANIMATION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/gfx/animation/animation.h" | 10 #include "ui/gfx/animation/animation.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 | 13 |
| 14 class AnimationDelegate; | 14 class AnimationDelegate; |
| 15 | 15 |
| 16 // Linear time bounded animation. As the animation progresses AnimateToState is | 16 // Linear time bounded animation. As the animation progresses AnimateToState is |
| 17 // invoked. | 17 // invoked. |
| 18 class GFX_EXPORT LinearAnimation : public Animation { | 18 class GFX_EXPORT LinearAnimation : public Animation { |
| 19 public: | 19 public: |
| 20 // Initializes everything except the duration. | 20 // Initializes everything except the duration. |
| 21 // | 21 // |
| 22 // Caller must make sure to call SetDuration() if they use this | 22 // Caller must make sure to call SetDuration() if they use this |
| 23 // constructor; it is preferable to use the full one, but sometimes | 23 // constructor; it is preferable to use the full one, but sometimes |
| 24 // duration can change between calls to Start() and we need to | 24 // duration can change between calls to Start() and we need to |
| 25 // expose this interface. | 25 // expose this interface. |
| 26 LinearAnimation(int frame_rate, AnimationDelegate* delegate); | 26 LinearAnimation(int frame_rate, AnimationDelegate* delegate); |
| 27 // As above, but uses a default frame rate. | |
| 28 explicit LinearAnimation(AnimationDelegate* delegate); | |
|
sky
2016/09/13 02:30:08
How about the following as the only constructor:
Evan Stade
2016/09/13 15:45:39
Done.
| |
| 27 | 29 |
| 28 // Initializes all fields. | 30 // Initializes all fields. |
| 29 LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate); | 31 LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate); |
| 30 | 32 |
| 31 // Gets the value for the current state, according to the animation curve in | 33 // Gets the value for the current state, according to the animation curve in |
| 32 // use. This class provides only for a linear relationship, however subclasses | 34 // use. This class provides only for a linear relationship, however subclasses |
| 33 // can override this to provide others. | 35 // can override this to provide others. |
| 34 double GetCurrentValue() const override; | 36 double GetCurrentValue() const override; |
| 35 | 37 |
| 36 // Change the current state of the animation to |new_value|. | 38 // Change the current state of the animation to |new_value|. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // If true, we're in end. This is used to determine if the animation should | 73 // If true, we're in end. This is used to determine if the animation should |
| 72 // be advanced to the end from AnimationStopped. | 74 // be advanced to the end from AnimationStopped. |
| 73 bool in_end_; | 75 bool in_end_; |
| 74 | 76 |
| 75 DISALLOW_COPY_AND_ASSIGN(LinearAnimation); | 77 DISALLOW_COPY_AND_ASSIGN(LinearAnimation); |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 } // namespace gfx | 80 } // namespace gfx |
| 79 | 81 |
| 80 #endif // APP_LINEAR_ANIMATION_H_ | 82 #endif // APP_LINEAR_ANIMATION_H_ |
| OLD | NEW |