OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/animation/layer_animation_controller.h" | 5 #include "cc/animation/layer_animation_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "cc/animation/animation.h" | 10 #include "cc/animation/animation.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return; | 141 return; |
142 | 142 |
143 for (size_t i = 0; i < animations_.size(); ++i) { | 143 for (size_t i = 0; i < animations_.size(); ++i) { |
144 Animation* animation = animations_[i]; | 144 Animation* animation = animations_[i]; |
145 if (!animation->is_impl_only()) | 145 if (!animation->is_impl_only()) |
146 continue; | 146 continue; |
147 | 147 |
148 if (!animation->InEffect(monotonic_time)) | 148 if (!animation->InEffect(monotonic_time)) |
149 continue; | 149 continue; |
150 | 150 |
151 double trimmed = animation->TrimTimeToCurrentIteration(monotonic_time); | 151 double trimmed = |
| 152 animation->TrimTimeToCurrentIteration(monotonic_time).InSecondsF(); |
152 switch (animation->target_property()) { | 153 switch (animation->target_property()) { |
153 case Animation::Opacity: { | 154 case Animation::Opacity: { |
154 AnimationEvent event(AnimationEvent::PropertyUpdate, | 155 AnimationEvent event(AnimationEvent::PropertyUpdate, |
155 id_, | 156 id_, |
156 animation->group(), | 157 animation->group(), |
157 Animation::Opacity, | 158 Animation::Opacity, |
158 monotonic_time); | 159 monotonic_time); |
159 const FloatAnimationCurve* float_animation_curve = | 160 const FloatAnimationCurve* float_animation_curve = |
160 animation->curve()->ToFloatAnimationCurve(); | 161 animation->curve()->ToFloatAnimationCurve(); |
161 event.opacity = float_animation_curve->GetValue(trimmed); | 162 event.opacity = float_animation_curve->GetValue(trimmed); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 850 } |
850 | 851 |
851 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { | 852 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { |
852 for (size_t i = 0; i < animations_.size(); ++i) { | 853 for (size_t i = 0; i < animations_.size(); ++i) { |
853 if (animations_[i]->run_state() == Animation::Starting || | 854 if (animations_[i]->run_state() == Animation::Starting || |
854 animations_[i]->run_state() == Animation::Running || | 855 animations_[i]->run_state() == Animation::Running || |
855 animations_[i]->run_state() == Animation::Paused) { | 856 animations_[i]->run_state() == Animation::Paused) { |
856 if (!animations_[i]->InEffect(monotonic_time)) | 857 if (!animations_[i]->InEffect(monotonic_time)) |
857 continue; | 858 continue; |
858 | 859 |
859 double trimmed = | 860 double trimmed = animations_[i] |
860 animations_[i]->TrimTimeToCurrentIteration(monotonic_time); | 861 ->TrimTimeToCurrentIteration(monotonic_time) |
| 862 .InSecondsF(); |
861 | 863 |
862 switch (animations_[i]->target_property()) { | 864 switch (animations_[i]->target_property()) { |
863 case Animation::Transform: { | 865 case Animation::Transform: { |
864 const TransformAnimationCurve* transform_animation_curve = | 866 const TransformAnimationCurve* transform_animation_curve = |
865 animations_[i]->curve()->ToTransformAnimationCurve(); | 867 animations_[i]->curve()->ToTransformAnimationCurve(); |
866 const gfx::Transform transform = | 868 const gfx::Transform transform = |
867 transform_animation_curve->GetValue(trimmed); | 869 transform_animation_curve->GetValue(trimmed); |
868 NotifyObserversTransformAnimated( | 870 NotifyObserversTransformAnimated( |
869 transform, | 871 transform, |
870 animations_[i]->affects_active_observers(), | 872 animations_[i]->affects_active_observers(), |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 value_observers_); | 1031 value_observers_); |
1030 LayerAnimationValueObserver* obs; | 1032 LayerAnimationValueObserver* obs; |
1031 while ((obs = it.GetNext()) != nullptr) | 1033 while ((obs = it.GetNext()) != nullptr) |
1032 if (obs->IsActive()) | 1034 if (obs->IsActive()) |
1033 return true; | 1035 return true; |
1034 } | 1036 } |
1035 return false; | 1037 return false; |
1036 } | 1038 } |
1037 | 1039 |
1038 } // namespace cc | 1040 } // namespace cc |
OLD | NEW |