OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 CC_TOP_CONTROLS_ANIMATION_H_ |
| 6 #define CC_TOP_CONTROLS_ANIMATION_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time.h" |
| 10 #include "ui/gfx/size.h" |
| 11 #include "ui/gfx/vector2d_f.h" |
| 12 |
| 13 namespace cc { |
| 14 |
| 15 class TimingFunction; |
| 16 |
| 17 // A small helper class that does the math for animations pertaining to the |
| 18 // position of the top controls. |
| 19 // |
| 20 // All sizes and vectors in this class's public methods are in the root scroll |
| 21 // layer's coordinate space. |
| 22 class TopControlsAnimation { |
| 23 public: |
| 24 // Construct with the state at the beginning of the animation. |
| 25 static scoped_ptr<TopControlsAnimation> Create(float start_y_offset, |
| 26 float top_controls_height, |
| 27 base::TimeTicks start_time, |
| 28 base::TimeDelta max_duration); |
| 29 |
| 30 ~TopControlsAnimation(); |
| 31 |
| 32 void SetDirection(bool showing); |
| 33 |
| 34 // Call these functions while the animation is in progress to output the |
| 35 // current state. |
| 36 float ScrollOffsetAtTime(base::TimeTicks time) const; |
| 37 bool IsAnimationCompleteAtTime(base::TimeTicks time) const; |
| 38 |
| 39 protected: |
| 40 TopControlsAnimation(float start_y_offset, |
| 41 float top_controls_height, |
| 42 base::TimeTicks start_time, |
| 43 base::TimeDelta max_duration); |
| 44 |
| 45 private: |
| 46 scoped_ptr<TimingFunction> timing_function_; |
| 47 const float top_controls_height_; |
| 48 const float start_y_offset_; |
| 49 const base::TimeTicks start_time_; |
| 50 const base::TimeDelta max_duration_; |
| 51 int direction_; |
| 52 }; |
| 53 |
| 54 } // namespace cc |
| 55 |
| 56 #endif // CC_TOP_CONTROLS_ANIMATION_H_ |
OLD | NEW |