| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | |
| 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "cc/animation/animation_curve.h" | |
| 11 #include "cc/base/cc_export.h" | |
| 12 #include "ui/gfx/geometry/scroll_offset.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 | |
| 16 class TimingFunction; | |
| 17 | |
| 18 class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve { | |
| 19 public: | |
| 20 static scoped_ptr<ScrollOffsetAnimationCurve> Create( | |
| 21 const gfx::ScrollOffset& target_value, | |
| 22 scoped_ptr<TimingFunction> timing_function); | |
| 23 | |
| 24 ~ScrollOffsetAnimationCurve() override; | |
| 25 | |
| 26 void SetInitialValue(const gfx::ScrollOffset& initial_value); | |
| 27 gfx::ScrollOffset GetValue(base::TimeDelta t) const; | |
| 28 gfx::ScrollOffset target_value() const { return target_value_; } | |
| 29 void UpdateTarget(double t, const gfx::ScrollOffset& new_target); | |
| 30 | |
| 31 // AnimationCurve implementation | |
| 32 base::TimeDelta Duration() const override; | |
| 33 CurveType Type() const override; | |
| 34 scoped_ptr<AnimationCurve> Clone() const override; | |
| 35 | |
| 36 private: | |
| 37 ScrollOffsetAnimationCurve(const gfx::ScrollOffset& target_value, | |
| 38 scoped_ptr <TimingFunction> timing_function); | |
| 39 | |
| 40 gfx::ScrollOffset initial_value_; | |
| 41 gfx::ScrollOffset target_value_; | |
| 42 base::TimeDelta total_animation_duration_; | |
| 43 | |
| 44 // Time from animation start to most recent UpdateTarget. | |
| 45 base::TimeDelta last_retarget_; | |
| 46 | |
| 47 scoped_ptr<TimingFunction> timing_function_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve); | |
| 50 }; | |
| 51 | |
| 52 } // namespace cc | |
| 53 | |
| 54 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ | |
| OLD | NEW |