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 = | 151 base::TimeDelta trimmed = |
152 animation->TrimTimeToCurrentIteration(monotonic_time).InSecondsF(); | 152 animation->TrimTimeToCurrentIteration(monotonic_time); |
153 switch (animation->target_property()) { | 153 switch (animation->target_property()) { |
154 case Animation::Opacity: { | 154 case Animation::Opacity: { |
155 AnimationEvent event(AnimationEvent::PropertyUpdate, | 155 AnimationEvent event(AnimationEvent::PropertyUpdate, |
156 id_, | 156 id_, |
157 animation->group(), | 157 animation->group(), |
158 Animation::Opacity, | 158 Animation::Opacity, |
159 monotonic_time); | 159 monotonic_time); |
160 const FloatAnimationCurve* float_animation_curve = | 160 const FloatAnimationCurve* float_animation_curve = |
161 animation->curve()->ToFloatAnimationCurve(); | 161 animation->curve()->ToFloatAnimationCurve(); |
162 event.opacity = float_animation_curve->GetValue(trimmed); | 162 event.opacity = float_animation_curve->GetValue(trimmed); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 } | 854 } |
855 | 855 |
856 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { | 856 void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { |
857 for (size_t i = 0; i < animations_.size(); ++i) { | 857 for (size_t i = 0; i < animations_.size(); ++i) { |
858 if (animations_[i]->run_state() == Animation::Starting || | 858 if (animations_[i]->run_state() == Animation::Starting || |
859 animations_[i]->run_state() == Animation::Running || | 859 animations_[i]->run_state() == Animation::Running || |
860 animations_[i]->run_state() == Animation::Paused) { | 860 animations_[i]->run_state() == Animation::Paused) { |
861 if (!animations_[i]->InEffect(monotonic_time)) | 861 if (!animations_[i]->InEffect(monotonic_time)) |
862 continue; | 862 continue; |
863 | 863 |
864 double trimmed = animations_[i] | 864 base::TimeDelta trimmed = |
865 ->TrimTimeToCurrentIteration(monotonic_time) | 865 animations_[i]->TrimTimeToCurrentIteration(monotonic_time); |
866 .InSecondsF(); | |
867 | 866 |
868 switch (animations_[i]->target_property()) { | 867 switch (animations_[i]->target_property()) { |
869 case Animation::Transform: { | 868 case Animation::Transform: { |
870 const TransformAnimationCurve* transform_animation_curve = | 869 const TransformAnimationCurve* transform_animation_curve = |
871 animations_[i]->curve()->ToTransformAnimationCurve(); | 870 animations_[i]->curve()->ToTransformAnimationCurve(); |
872 const gfx::Transform transform = | 871 const gfx::Transform transform = |
873 transform_animation_curve->GetValue(trimmed); | 872 transform_animation_curve->GetValue(trimmed); |
874 NotifyObserversTransformAnimated( | 873 NotifyObserversTransformAnimated( |
875 transform, | 874 transform, |
876 animations_[i]->affects_active_observers(), | 875 animations_[i]->affects_active_observers(), |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 value_observers_); | 1034 value_observers_); |
1036 LayerAnimationValueObserver* obs; | 1035 LayerAnimationValueObserver* obs; |
1037 while ((obs = it.GetNext()) != nullptr) | 1036 while ((obs = it.GetNext()) != nullptr) |
1038 if (obs->IsActive()) | 1037 if (obs->IsActive()) |
1039 return true; | 1038 return true; |
1040 } | 1039 } |
1041 return false; | 1040 return false; |
1042 } | 1041 } |
1043 | 1042 |
1044 } // namespace cc | 1043 } // namespace cc |
OLD | NEW |