OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/multi_animation.h" | 5 #include "app/multi_animation.h" |
6 | 6 |
7 #include "app/animation_delegate.h" | 7 #include "app/animation_delegate.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 // Default interval, in ms. | 10 // Default interval, in ms. |
(...skipping 13 matching lines...) Expand all Loading... |
24 parts_(parts), | 24 parts_(parts), |
25 cycle_time_ms_(TotalTime(parts)), | 25 cycle_time_ms_(TotalTime(parts)), |
26 current_value_(0), | 26 current_value_(0), |
27 current_part_index_(0), | 27 current_part_index_(0), |
28 continuous_(true) { | 28 continuous_(true) { |
29 DCHECK(!parts_.empty()); | 29 DCHECK(!parts_.empty()); |
30 } | 30 } |
31 | 31 |
32 MultiAnimation::~MultiAnimation() {} | 32 MultiAnimation::~MultiAnimation() {} |
33 | 33 |
| 34 double MultiAnimation::GetCurrentValue() const { |
| 35 return current_value_; |
| 36 } |
| 37 |
34 void MultiAnimation::Step(base::TimeTicks time_now) { | 38 void MultiAnimation::Step(base::TimeTicks time_now) { |
35 double last_value = current_value_; | 39 double last_value = current_value_; |
36 size_t last_index = current_part_index_; | 40 size_t last_index = current_part_index_; |
37 | 41 |
38 int delta = static_cast<int>((time_now - start_time()).InMilliseconds()); | 42 int delta = static_cast<int>((time_now - start_time()).InMilliseconds()); |
39 if (delta >= cycle_time_ms_ && !continuous_) { | 43 if (delta >= cycle_time_ms_ && !continuous_) { |
40 current_part_index_ = parts_.size() - 1; | 44 current_part_index_ = parts_.size() - 1; |
41 current_value_ = Tween::CalculateValue(parts_[current_part_index_].type, 1); | 45 current_value_ = Tween::CalculateValue(parts_[current_part_index_].type, 1); |
42 Stop(); | 46 Stop(); |
43 return; | 47 return; |
(...skipping 27 matching lines...) Expand all Loading... |
71 return parts_[i]; | 75 return parts_[i]; |
72 } | 76 } |
73 | 77 |
74 *time_ms -= parts_[i].time_ms; | 78 *time_ms -= parts_[i].time_ms; |
75 } | 79 } |
76 NOTREACHED(); | 80 NOTREACHED(); |
77 *time_ms = 0; | 81 *time_ms = 0; |
78 *part_index = 0; | 82 *part_index = 0; |
79 return parts_[0]; | 83 return parts_[0]; |
80 } | 84 } |
OLD | NEW |