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 "sky/engine/config.h" | |
6 #include "sky/engine/core/animation/InterpolationEffect.h" | 5 #include "sky/engine/core/animation/InterpolationEffect.h" |
7 | 6 |
8 namespace blink { | 7 namespace blink { |
9 | 8 |
10 PassOwnPtr<Vector<RefPtr<Interpolation> > > InterpolationEffect::getActiveInterp
olations(double fraction, double iterationDuration) const | 9 PassOwnPtr<Vector<RefPtr<Interpolation> > > InterpolationEffect::getActiveInterp
olations(double fraction, double iterationDuration) const |
11 { | 10 { |
12 | 11 |
13 Vector<RefPtr<Interpolation> >* result = new Vector<RefPtr<Interpolation> >(
); | 12 Vector<RefPtr<Interpolation> >* result = new Vector<RefPtr<Interpolation> >(
); |
14 | 13 |
15 for (size_t i = 0; i < m_interpolations.size(); ++i) { | 14 for (size_t i = 0; i < m_interpolations.size(); ++i) { |
16 const InterpolationRecord* record = m_interpolations[i].get(); | 15 const InterpolationRecord* record = m_interpolations[i].get(); |
17 if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) { | 16 if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) { |
18 RefPtr<Interpolation> interpolation = record->m_interpolation; | 17 RefPtr<Interpolation> interpolation = record->m_interpolation; |
19 double localFraction = (fraction - record->m_start) / (record->m_end
- record->m_start); | 18 double localFraction = (fraction - record->m_start) / (record->m_end
- record->m_start); |
20 if (record->m_easing) | 19 if (record->m_easing) |
21 localFraction = record->m_easing->evaluate(localFraction, accura
cyForDuration(iterationDuration)); | 20 localFraction = record->m_easing->evaluate(localFraction, accura
cyForDuration(iterationDuration)); |
22 interpolation->interpolate(0, localFraction); | 21 interpolation->interpolate(0, localFraction); |
23 result->append(interpolation); | 22 result->append(interpolation); |
24 } | 23 } |
25 } | 24 } |
26 | 25 |
27 return adoptPtr(result); | 26 return adoptPtr(result); |
28 } | 27 } |
29 | 28 |
30 } | 29 } |
OLD | NEW |