OLD | NEW |
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 #include "cc/animation/scroll_offset_animation_curve.h" | 5 #include "cc/animation/scroll_offset_animation_curve.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return target_value_; | 76 return target_value_; |
77 | 77 |
78 double progress = (timing_function_->GetValue(t / duration)); | 78 double progress = (timing_function_->GetValue(t / duration)); |
79 return gfx::ScrollOffset( | 79 return gfx::ScrollOffset( |
80 gfx::Tween::FloatValueBetween( | 80 gfx::Tween::FloatValueBetween( |
81 progress, initial_value_.x(), target_value_.x()), | 81 progress, initial_value_.x(), target_value_.x()), |
82 gfx::Tween::FloatValueBetween( | 82 gfx::Tween::FloatValueBetween( |
83 progress, initial_value_.y(), target_value_.y())); | 83 progress, initial_value_.y(), target_value_.y())); |
84 } | 84 } |
85 | 85 |
86 double ScrollOffsetAnimationCurve::Duration() const { | 86 base::TimeDelta ScrollOffsetAnimationCurve::Duration() const { |
87 return total_animation_duration_.InSecondsF(); | 87 return total_animation_duration_; |
88 } | 88 } |
89 | 89 |
90 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const { | 90 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const { |
91 return ScrollOffset; | 91 return ScrollOffset; |
92 } | 92 } |
93 | 93 |
94 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { | 94 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { |
95 scoped_ptr<TimingFunction> timing_function( | 95 scoped_ptr<TimingFunction> timing_function( |
96 static_cast<TimingFunction*>(timing_function_->Clone().release())); | 96 static_cast<TimingFunction*>(timing_function_->Clone().release())); |
97 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone = | 97 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone = |
(...skipping 26 matching lines...) Expand all Loading... |
124 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); | 124 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); |
125 | 125 |
126 initial_value_ = current_position; | 126 initial_value_ = current_position; |
127 target_value_ = new_target; | 127 target_value_ = new_target; |
128 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); | 128 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); |
129 last_retarget_ = base::TimeDelta::FromSecondsD(t); | 129 last_retarget_ = base::TimeDelta::FromSecondsD(t); |
130 timing_function_ = EaseOutWithInitialVelocity(new_velocity); | 130 timing_function_ = EaseOutWithInitialVelocity(new_velocity); |
131 } | 131 } |
132 | 132 |
133 } // namespace cc | 133 } // namespace cc |
OLD | NEW |