Chromium Code Reviews| Index: cc/top_controls_animation.h |
| diff --git a/cc/top_controls_animation.h b/cc/top_controls_animation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..79037ceee4aa261f4e0221dd98eab553412de2b1 |
| --- /dev/null |
| +++ b/cc/top_controls_animation.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_TOP_CONTROLS_ANIMATION_H_ |
| +#define CC_TOP_CONTROLS_ANIMATION_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/time.h" |
| +#include "ui/gfx/size.h" |
| +#include "ui/gfx/vector2d_f.h" |
| + |
| +namespace cc { |
| + |
| +class TimingFunction; |
| + |
| +// A small helper class that does the math for animations pertaining to the |
| +// position of the top controls. |
| +// |
| +// All sizes and vectors in this class's public methods are in the root scroll |
| +// layer's coordinate space. |
| +class TopControlsAnimation { |
| + public: |
| + // Construct with the state at the beginning of the animation. |
| + static scoped_ptr<TopControlsAnimation> create(float startScrollOffset, |
|
aelias_OOO_until_Jul13
2012/12/19 08:31:18
New compositor files should use underscore style,
Ted C
2012/12/19 21:34:17
Blast...I forgot to convert the parameters to chro
|
| + float topControlsHeight, |
| + base::TimeTicks startTime, |
| + base::TimeDelta maxDuration); |
| + |
| + ~TopControlsAnimation(); |
| + |
| + void setDirection(bool showing); |
| + |
| + // Call these functions while the animation is in progress to output the |
| + // current state. |
| + float scrollOffsetAtTime(base::TimeTicks time) const; |
| + bool isAnimationCompleteAtTime(base::TimeTicks time) const; |
| + |
| + protected: |
| + TopControlsAnimation(float startScrollOffset, |
| + float topControlsHeight, |
| + base::TimeTicks startTime, |
| + base::TimeDelta maxDuration); |
| + |
| + private: |
| + scoped_ptr<TimingFunction> timing_function_; |
| + const float top_controls_height_; |
| + const float start_scroll_offset_; |
|
aelias_OOO_until_Jul13
2012/12/19 08:31:18
Please rename to start_y_offset_.
Ted C
2012/12/19 21:34:17
Done.
|
| + const base::TimeTicks start_time_; |
| + const base::TimeDelta max_duration_; |
| + int direction_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_TOP_CONTROLS_ANIMATION_H_ |