Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: cc/animation/scroll_offset_animation_curve.h

Issue 393713002: Scroll offset animation curve retargeting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove workaround. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/animation/scroll_offset_animation_curve.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ 5 #ifndef CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_
6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ 6 #define CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/animation/animation_curve.h" 10 #include "cc/animation/animation_curve.h"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 class TimingFunction; 15 class TimingFunction;
16 16
17 class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve { 17 class CC_EXPORT ScrollOffsetAnimationCurve : public AnimationCurve {
18 public: 18 public:
19 static scoped_ptr<ScrollOffsetAnimationCurve> Create( 19 static scoped_ptr<ScrollOffsetAnimationCurve> Create(
20 const gfx::Vector2dF& target_value, 20 const gfx::Vector2dF& target_value,
21 scoped_ptr<TimingFunction> timing_function); 21 scoped_ptr<TimingFunction> timing_function);
22 22
23 virtual ~ScrollOffsetAnimationCurve(); 23 virtual ~ScrollOffsetAnimationCurve();
24 24
25 void SetInitialValue(const gfx::Vector2dF& initial_value); 25 void SetInitialValue(const gfx::Vector2dF& initial_value);
26 gfx::Vector2dF GetValue(double t) const; 26 gfx::Vector2dF GetValue(double t) const;
27 gfx::Vector2dF target_value() const { return target_value_; }
28 void UpdateTarget(double t, const gfx::Vector2dF& new_target);
27 29
28 // AnimationCurve implementation 30 // AnimationCurve implementation
29 virtual double Duration() const OVERRIDE; 31 virtual double Duration() const OVERRIDE;
30 virtual CurveType Type() const OVERRIDE; 32 virtual CurveType Type() const OVERRIDE;
31 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; 33 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
32 34
33 private: 35 private:
34 ScrollOffsetAnimationCurve(const gfx::Vector2dF& target_value, 36 ScrollOffsetAnimationCurve(const gfx::Vector2dF& target_value,
35 scoped_ptr <TimingFunction> timing_function); 37 scoped_ptr <TimingFunction> timing_function);
36 38
37 gfx::Vector2dF initial_value_; 39 gfx::Vector2dF initial_value_;
38 gfx::Vector2dF target_value_; 40 gfx::Vector2dF target_value_;
39 base::TimeDelta duration_; 41 base::TimeDelta total_animation_duration_;
42
43 // Time from animation start to most recent UpdateTarget.
44 base::TimeDelta last_retarget_;
40 45
41 scoped_ptr<TimingFunction> timing_function_; 46 scoped_ptr<TimingFunction> timing_function_;
42 47
43 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve); 48 DISALLOW_COPY_AND_ASSIGN(ScrollOffsetAnimationCurve);
44 }; 49 };
45 50
46 } // namespace cc 51 } // namespace cc
47 52
48 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_ 53 #endif // CC_ANIMATION_SCROLL_OFFSET_ANIMATION_CURVE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/animation/scroll_offset_animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698