| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 progress, initial_value_.x(), target_value_.x()), | 83 progress, initial_value_.x(), target_value_.x()), |
| 84 gfx::Tween::FloatValueBetween( | 84 gfx::Tween::FloatValueBetween( |
| 85 progress, initial_value_.y(), target_value_.y())); | 85 progress, initial_value_.y(), target_value_.y())); |
| 86 } | 86 } |
| 87 | 87 |
| 88 base::TimeDelta ScrollOffsetAnimationCurve::Duration() const { | 88 base::TimeDelta ScrollOffsetAnimationCurve::Duration() const { |
| 89 return total_animation_duration_; | 89 return total_animation_duration_; |
| 90 } | 90 } |
| 91 | 91 |
| 92 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const { | 92 AnimationCurve::CurveType ScrollOffsetAnimationCurve::Type() const { |
| 93 return SCROLL_OFFSET; | 93 return ScrollOffset; |
| 94 } | 94 } |
| 95 | 95 |
| 96 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { | 96 scoped_ptr<AnimationCurve> ScrollOffsetAnimationCurve::Clone() const { |
| 97 scoped_ptr<TimingFunction> timing_function( | 97 scoped_ptr<TimingFunction> timing_function( |
| 98 static_cast<TimingFunction*>(timing_function_->Clone().release())); | 98 static_cast<TimingFunction*>(timing_function_->Clone().release())); |
| 99 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone = | 99 scoped_ptr<ScrollOffsetAnimationCurve> curve_clone = |
| 100 Create(target_value_, timing_function.Pass()); | 100 Create(target_value_, timing_function.Pass()); |
| 101 curve_clone->initial_value_ = initial_value_; | 101 curve_clone->initial_value_ = initial_value_; |
| 102 curve_clone->total_animation_duration_ = total_animation_duration_; | 102 curve_clone->total_animation_duration_ = total_animation_duration_; |
| 103 curve_clone->last_retarget_ = last_retarget_; | 103 curve_clone->last_retarget_ = last_retarget_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 127 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); | 127 (MaximumDimension(old_delta) / MaximumDimension(new_delta)); |
| 128 | 128 |
| 129 initial_value_ = current_position; | 129 initial_value_ = current_position; |
| 130 target_value_ = new_target; | 130 target_value_ = new_target; |
| 131 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); | 131 total_animation_duration_ = base::TimeDelta::FromSecondsD(t + new_duration); |
| 132 last_retarget_ = base::TimeDelta::FromSecondsD(t); | 132 last_retarget_ = base::TimeDelta::FromSecondsD(t); |
| 133 timing_function_ = EaseOutWithInitialVelocity(new_velocity); | 133 timing_function_ = EaseOutWithInitialVelocity(new_velocity); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace cc | 136 } // namespace cc |
| OLD | NEW |