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 // Default frame rate (hz). | |
| 21 static const int kDefaultFrameRate = 60; | |
| 22 | |
| 20 // Initializes everything except the duration. | 23 // Initializes everything except the duration. |
| 21 // | 24 // |
| 22 // Caller must make sure to call SetDuration() if they use this | 25 // Caller must make sure to call SetDuration() if they use this |
| 23 // constructor; it is preferable to use the full one, but sometimes | 26 // constructor; it is preferable to use the full one, but sometimes |
| 24 // duration can change between calls to Start() and we need to | 27 // duration can change between calls to Start() and we need to |
| 25 // expose this interface. | 28 // expose this interface. |
| 26 LinearAnimation(int frame_rate, AnimationDelegate* delegate); | 29 LinearAnimation(AnimationDelegate* delegate, |
|
sky
2016/09/13 19:22:15
As the second parameter is optional I believe you
Evan Stade
2016/09/13 22:01:24
Done.
| |
| 30 int frame_rate = kDefaultFrameRate); | |
| 27 | 31 |
| 28 // Initializes all fields. | 32 // Initializes all fields. |
| 29 LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate); | 33 LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate); |
| 30 | 34 |
| 31 // Gets the value for the current state, according to the animation curve in | 35 // 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 | 36 // use. This class provides only for a linear relationship, however subclasses |
| 33 // can override this to provide others. | 37 // can override this to provide others. |
| 34 double GetCurrentValue() const override; | 38 double GetCurrentValue() const override; |
| 35 | 39 |
| 36 // Change the current state of the animation to |new_value|. | 40 // 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 | 75 // If true, we're in end. This is used to determine if the animation should |
| 72 // be advanced to the end from AnimationStopped. | 76 // be advanced to the end from AnimationStopped. |
| 73 bool in_end_; | 77 bool in_end_; |
| 74 | 78 |
| 75 DISALLOW_COPY_AND_ASSIGN(LinearAnimation); | 79 DISALLOW_COPY_AND_ASSIGN(LinearAnimation); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace gfx | 82 } // namespace gfx |
| 79 | 83 |
| 80 #endif // APP_LINEAR_ANIMATION_H_ | 84 #endif // APP_LINEAR_ANIMATION_H_ |
| OLD | NEW |