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

Side by Side Diff: ui/compositor/float_animation_curve_adapter.cc

Issue 693883004: Make cc::animation::TrimTimeToCurrentIteration,cc::AnimationCurve::Duration use TimeTicks/TimeDelta (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/float_animation_curve_adapter.h" 5 #include "ui/compositor/float_animation_curve_adapter.h"
6 6
7 namespace ui { 7 namespace ui {
8 8
9 FloatAnimationCurveAdapter::FloatAnimationCurveAdapter( 9 FloatAnimationCurveAdapter::FloatAnimationCurveAdapter(
10 gfx::Tween::Type tween_type, 10 gfx::Tween::Type tween_type,
11 float initial_value, 11 float initial_value,
12 float target_value, 12 float target_value,
13 base::TimeDelta duration) 13 base::TimeDelta duration)
14 : tween_type_(tween_type), 14 : tween_type_(tween_type),
15 initial_value_(initial_value), 15 initial_value_(initial_value),
16 target_value_(target_value), 16 target_value_(target_value),
17 duration_(duration) { 17 duration_(duration) {
18 } 18 }
19 19
20 double FloatAnimationCurveAdapter::Duration() const { 20 base::TimeDelta FloatAnimationCurveAdapter::Duration() const {
21 return duration_.InSecondsF(); 21 return duration_;
22 } 22 }
23 23
24 scoped_ptr<cc::AnimationCurve> FloatAnimationCurveAdapter::Clone() const { 24 scoped_ptr<cc::AnimationCurve> FloatAnimationCurveAdapter::Clone() const {
25 return make_scoped_ptr(new FloatAnimationCurveAdapter( 25 return make_scoped_ptr(new FloatAnimationCurveAdapter(
26 tween_type_, initial_value_, target_value_, duration_)); 26 tween_type_, initial_value_, target_value_, duration_));
27 } 27 }
28 28
29 float FloatAnimationCurveAdapter::GetValue(double t) const { 29 float FloatAnimationCurveAdapter::GetValue(double t) const {
30 if (t >= duration_.InSecondsF()) 30 if (t >= duration_.InSecondsF())
31 return target_value_; 31 return target_value_;
32 if (t <= 0.0) 32 if (t <= 0.0)
33 return initial_value_; 33 return initial_value_;
34 double progress = t / duration_.InSecondsF(); 34 double progress = t / duration_.InSecondsF();
35 return gfx::Tween::FloatValueBetween( 35 return gfx::Tween::FloatValueBetween(
36 gfx::Tween::CalculateValue(tween_type_, progress), 36 gfx::Tween::CalculateValue(tween_type_, progress),
37 initial_value_, 37 initial_value_,
38 target_value_); 38 target_value_);
39 } 39 }
40 40
41 } // namespace ui 41 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/float_animation_curve_adapter.h ('k') | ui/compositor/transform_animation_curve_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698