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 #ifndef InterpolationEffect_h | 5 #ifndef InterpolationEffect_h |
6 #define InterpolationEffect_h | 6 #define InterpolationEffect_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/Interpolation.h" | 9 #include "core/animation/Interpolation.h" |
10 #include "core/animation/Keyframe.h" | 10 #include "core/animation/Keyframe.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 void getActiveInterpolations(double fraction, double iterationDuration, Vect
or<RefPtr<Interpolation>>&) const; | 35 void getActiveInterpolations(double fraction, double iterationDuration, Vect
or<RefPtr<Interpolation>>&) const; |
36 | 36 |
37 void addInterpolation(PassRefPtr<Interpolation> interpolation, PassRefPtr<Ti
mingFunction> easing, double start, double end, double applyFrom, double applyTo
) | 37 void addInterpolation(PassRefPtr<Interpolation> interpolation, PassRefPtr<Ti
mingFunction> easing, double start, double end, double applyFrom, double applyTo
) |
38 { | 38 { |
39 m_interpolations.append(InterpolationRecord(interpolation, easing, start
, end, applyFrom, applyTo)); | 39 m_interpolations.append(InterpolationRecord(interpolation, easing, start
, end, applyFrom, applyTo)); |
40 } | 40 } |
41 | 41 |
42 void addInterpolationsFromKeyframes(PropertyHandle, const Keyframe::Property
SpecificKeyframe& keyframeA, const Keyframe::PropertySpecificKeyframe& keyframeB
, double applyFrom, double applyTo); | 42 void addInterpolationsFromKeyframes(PropertyHandle, const Keyframe::Property
SpecificKeyframe& keyframeA, const Keyframe::PropertySpecificKeyframe& keyframeB
, double applyFrom, double applyTo); |
43 | 43 |
44 template<typename T> | |
45 inline void forEachInterpolation(const T& callback) | |
46 { | |
47 for (auto& record : m_interpolations) | |
48 callback(*record.m_interpolation); | |
49 } | |
50 | |
51 private: | 44 private: |
52 struct InterpolationRecord { | 45 struct InterpolationRecord { |
53 InterpolationRecord(PassRefPtr<Interpolation> interpolation, PassRefPtr<
TimingFunction> easing, double start, double end, double applyFrom, double apply
To) | 46 InterpolationRecord(PassRefPtr<Interpolation> interpolation, PassRefPtr<
TimingFunction> easing, double start, double end, double applyFrom, double apply
To) |
54 : m_interpolation(interpolation) | 47 : m_interpolation(interpolation) |
55 , m_easing(easing) | 48 , m_easing(easing) |
56 , m_start(start) | 49 , m_start(start) |
57 , m_end(end) | 50 , m_end(end) |
58 , m_applyFrom(applyFrom) | 51 , m_applyFrom(applyFrom) |
59 , m_applyTo(applyTo) | 52 , m_applyTo(applyTo) |
60 { } | 53 { } |
61 | 54 |
62 RefPtr<Interpolation> m_interpolation; | 55 RefPtr<Interpolation> m_interpolation; |
63 RefPtr<TimingFunction> m_easing; | 56 RefPtr<TimingFunction> m_easing; |
64 double m_start; | 57 double m_start; |
65 double m_end; | 58 double m_end; |
66 double m_applyFrom; | 59 double m_applyFrom; |
67 double m_applyTo; | 60 double m_applyTo; |
68 }; | 61 }; |
69 | 62 |
70 bool m_isPopulated; | 63 bool m_isPopulated; |
71 Vector<InterpolationRecord> m_interpolations; | 64 Vector<InterpolationRecord> m_interpolations; |
72 }; | 65 }; |
73 | 66 |
74 } // namespace blink | 67 } // namespace blink |
75 | 68 |
76 #endif // InterpolationEffect_h | 69 #endif // InterpolationEffect_h |
OLD | NEW |