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/test/animation_test_common.h" | 5 #include "cc/test/animation_test_common.h" |
6 | 6 |
7 #include "cc/animation/animation_id_provider.h" | 7 #include "cc/animation/animation_id_provider.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 func = EaseTimingFunction::Create(); | 37 func = EaseTimingFunction::Create(); |
38 if (duration > 0.0) | 38 if (duration > 0.0) |
39 curve->AddKeyframe( | 39 curve->AddKeyframe( |
40 FloatKeyframe::Create(base::TimeDelta(), start_opacity, func.Pass())); | 40 FloatKeyframe::Create(base::TimeDelta(), start_opacity, func.Pass())); |
41 curve->AddKeyframe(FloatKeyframe::Create( | 41 curve->AddKeyframe(FloatKeyframe::Create( |
42 base::TimeDelta::FromSecondsD(duration), end_opacity, nullptr)); | 42 base::TimeDelta::FromSecondsD(duration), end_opacity, nullptr)); |
43 | 43 |
44 int id = AnimationIdProvider::NextAnimationId(); | 44 int id = AnimationIdProvider::NextAnimationId(); |
45 | 45 |
46 scoped_ptr<Animation> animation( | 46 scoped_ptr<Animation> animation( |
47 Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(), | 47 Animation::Create(curve.Pass(), |
48 Animation::OPACITY)); | 48 id, |
| 49 AnimationIdProvider::NextGroupId(), |
| 50 Animation::Opacity)); |
49 animation->set_needs_synchronized_start_time(true); | 51 animation->set_needs_synchronized_start_time(true); |
50 | 52 |
51 target->AddAnimation(animation.Pass()); | 53 target->AddAnimation(animation.Pass()); |
52 return id; | 54 return id; |
53 } | 55 } |
54 | 56 |
55 template <class Target> | 57 template <class Target> |
56 int AddAnimatedTransform(Target* target, | 58 int AddAnimatedTransform(Target* target, |
57 double duration, | 59 double duration, |
58 TransformOperations start_operations, | 60 TransformOperations start_operations, |
59 TransformOperations operations) { | 61 TransformOperations operations) { |
60 scoped_ptr<KeyframedTransformAnimationCurve> | 62 scoped_ptr<KeyframedTransformAnimationCurve> |
61 curve(KeyframedTransformAnimationCurve::Create()); | 63 curve(KeyframedTransformAnimationCurve::Create()); |
62 | 64 |
63 if (duration > 0.0) { | 65 if (duration > 0.0) { |
64 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(), | 66 curve->AddKeyframe(TransformKeyframe::Create(base::TimeDelta(), |
65 start_operations, nullptr)); | 67 start_operations, nullptr)); |
66 } | 68 } |
67 | 69 |
68 curve->AddKeyframe(TransformKeyframe::Create( | 70 curve->AddKeyframe(TransformKeyframe::Create( |
69 base::TimeDelta::FromSecondsD(duration), operations, nullptr)); | 71 base::TimeDelta::FromSecondsD(duration), operations, nullptr)); |
70 | 72 |
71 int id = AnimationIdProvider::NextAnimationId(); | 73 int id = AnimationIdProvider::NextAnimationId(); |
72 | 74 |
73 scoped_ptr<Animation> animation( | 75 scoped_ptr<Animation> animation( |
74 Animation::Create(curve.Pass(), id, AnimationIdProvider::NextGroupId(), | 76 Animation::Create(curve.Pass(), |
75 Animation::TRANSFORM)); | 77 id, |
| 78 AnimationIdProvider::NextGroupId(), |
| 79 Animation::Transform)); |
76 animation->set_needs_synchronized_start_time(true); | 80 animation->set_needs_synchronized_start_time(true); |
77 | 81 |
78 target->AddAnimation(animation.Pass()); | 82 target->AddAnimation(animation.Pass()); |
79 return id; | 83 return id; |
80 } | 84 } |
81 | 85 |
82 template <class Target> | 86 template <class Target> |
83 int AddAnimatedTransform(Target* target, | 87 int AddAnimatedTransform(Target* target, |
84 double duration, | 88 double duration, |
85 int delta_x, | 89 int delta_x, |
(...skipping 25 matching lines...) Expand all Loading... |
111 } | 115 } |
112 | 116 |
113 FilterOperations filters; | 117 FilterOperations filters; |
114 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness)); | 118 filters.Append(FilterOperation::CreateBrightnessFilter(end_brightness)); |
115 curve->AddKeyframe(FilterKeyframe::Create( | 119 curve->AddKeyframe(FilterKeyframe::Create( |
116 base::TimeDelta::FromSecondsD(duration), filters, nullptr)); | 120 base::TimeDelta::FromSecondsD(duration), filters, nullptr)); |
117 | 121 |
118 int id = AnimationIdProvider::NextAnimationId(); | 122 int id = AnimationIdProvider::NextAnimationId(); |
119 | 123 |
120 scoped_ptr<Animation> animation(Animation::Create( | 124 scoped_ptr<Animation> animation(Animation::Create( |
121 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::FILTER)); | 125 curve.Pass(), id, AnimationIdProvider::NextGroupId(), Animation::Filter)); |
122 animation->set_needs_synchronized_start_time(true); | 126 animation->set_needs_synchronized_start_time(true); |
123 | 127 |
124 target->AddAnimation(animation.Pass()); | 128 target->AddAnimation(animation.Pass()); |
125 return id; | 129 return id; |
126 } | 130 } |
127 | 131 |
128 FakeFloatAnimationCurve::FakeFloatAnimationCurve() | 132 FakeFloatAnimationCurve::FakeFloatAnimationCurve() |
129 : duration_(base::TimeDelta::FromSecondsD(1.0)) { | 133 : duration_(base::TimeDelta::FromSecondsD(1.0)) { |
130 } | 134 } |
131 | 135 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 double duration, | 350 double duration, |
347 float start_brightness, | 351 float start_brightness, |
348 float end_brightness) { | 352 float end_brightness) { |
349 return AddAnimatedFilter(layer->layer_animation_controller(), | 353 return AddAnimatedFilter(layer->layer_animation_controller(), |
350 duration, | 354 duration, |
351 start_brightness, | 355 start_brightness, |
352 end_brightness); | 356 end_brightness); |
353 } | 357 } |
354 | 358 |
355 } // namespace cc | 359 } // namespace cc |
OLD | NEW |