OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/animation/InterpolationEffect.h" | 5 #include "core/animation/InterpolationEffect.h" |
6 | 6 |
7 #include "platform/animation/AnimationUtilities.h" | 7 #include "platform/animation/AnimationUtilities.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 double recordLength = record.m_end - record.m_start; | 21 double recordLength = record.m_end - record.m_start; |
22 double localFraction = | 22 double localFraction = |
23 recordLength ? (fraction - record.m_start) / recordLength : 0.0; | 23 recordLength ? (fraction - record.m_start) / recordLength : 0.0; |
24 if (record.m_easing) | 24 if (record.m_easing) |
25 localFraction = record.m_easing->evaluate( | 25 localFraction = record.m_easing->evaluate( |
26 localFraction, accuracyForDuration(iterationDuration)); | 26 localFraction, accuracyForDuration(iterationDuration)); |
27 interpolation->interpolate(0, localFraction); | 27 interpolation->interpolate(0, localFraction); |
28 if (resultIndex < existingSize) | 28 if (resultIndex < existingSize) |
29 result[resultIndex++] = interpolation; | 29 result[resultIndex++] = interpolation; |
30 else | 30 else |
31 result.append(interpolation); | 31 result.push_back(interpolation); |
32 } | 32 } |
33 } | 33 } |
34 if (resultIndex < existingSize) | 34 if (resultIndex < existingSize) |
35 result.shrink(resultIndex); | 35 result.shrink(resultIndex); |
36 } | 36 } |
37 | 37 |
38 void InterpolationEffect::addInterpolationsFromKeyframes( | 38 void InterpolationEffect::addInterpolationsFromKeyframes( |
39 PropertyHandle property, | 39 PropertyHandle property, |
40 const Keyframe::PropertySpecificKeyframe& keyframeA, | 40 const Keyframe::PropertySpecificKeyframe& keyframeA, |
41 const Keyframe::PropertySpecificKeyframe& keyframeB, | 41 const Keyframe::PropertySpecificKeyframe& keyframeB, |
42 double applyFrom, | 42 double applyFrom, |
43 double applyTo) { | 43 double applyTo) { |
44 addInterpolation(keyframeA.createInterpolation(property, keyframeB), | 44 addInterpolation(keyframeA.createInterpolation(property, keyframeB), |
45 &keyframeA.easing(), keyframeA.offset(), keyframeB.offset(), | 45 &keyframeA.easing(), keyframeA.offset(), keyframeB.offset(), |
46 applyFrom, applyTo); | 46 applyFrom, applyTo); |
47 } | 47 } |
48 | 48 |
49 } // namespace blink | 49 } // namespace blink |
OLD | NEW |