Chromium Code Reviews| 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 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
| |
| 26 float topControlsHeight, | |
| 27 base::TimeTicks startTime, | |
| 28 base::TimeDelta maxDuration); | |
| 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 startScrollOffset, | |
| 41 float topControlsHeight, | |
| 42 base::TimeTicks startTime, | |
| 43 base::TimeDelta maxDuration); | |
| 44 | |
| 45 private: | |
| 46 scoped_ptr<TimingFunction> timing_function_; | |
| 47 const float top_controls_height_; | |
| 48 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.
| |
| 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 |