OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 bool isInPlay() const { return ensureCalculated().isInPlay; } | 91 bool isInPlay() const { return ensureCalculated().isInPlay; } |
92 double currentIteration() const { return ensureCalculated().currentIteration
; } | 92 double currentIteration() const { return ensureCalculated().currentIteration
; } |
93 double timeFraction() const { return ensureCalculated().timeFraction; } | 93 double timeFraction() const { return ensureCalculated().timeFraction; } |
94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo
ForwardsEffectChange; } | 94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo
ForwardsEffectChange; } |
95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR
everseEffectChange; } | 95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR
everseEffectChange; } |
96 | 96 |
97 double iterationDuration() const; | 97 double iterationDuration() const; |
98 double activeDurationInternal() const; | 98 double activeDurationInternal() const; |
99 double endTimeInternal() const { return specifiedTiming().startDelay + activ
eDurationInternal() + specifiedTiming().endDelay; } | 99 double endTimeInternal() const { return specifiedTiming().startDelay + activ
eDurationInternal() + specifiedTiming().endDelay; } |
100 | 100 |
101 const Animation* animation() const { return m_animation; } | 101 const Animation* animation() const; |
102 Animation* animation() { return m_animation; } | 102 Animation* animation(); |
103 const Timing& specifiedTiming() const { return m_timing; } | 103 const Timing& specifiedTiming() const { return m_timing; } |
104 AnimationEffectTiming* timing(); | 104 AnimationEffectTiming* timing(); |
105 void updateSpecifiedTiming(const Timing&); | 105 void updateSpecifiedTiming(const Timing&); |
106 | 106 |
107 void computedTiming(ComputedTimingProperties&); | 107 void computedTiming(ComputedTimingProperties&); |
108 ComputedTimingProperties computedTiming(); | 108 ComputedTimingProperties computedTiming(); |
109 | 109 |
110 void setName(const String& name) { m_name = name; } | 110 void setName(const String& name) { m_name = name; } |
111 const String& name() const { return m_name; } | 111 const String& name() const { return m_name; } |
112 | 112 |
113 DECLARE_VIRTUAL_TRACE(); | 113 DECLARE_VIRTUAL_TRACE(); |
114 | 114 |
115 protected: | 115 protected: |
116 explicit AnimationEffect(const Timing&, EventDelegate* = nullptr); | 116 explicit AnimationEffect(const Timing&, EventDelegate* = nullptr); |
117 | 117 |
118 // When AnimationEffect receives a new inherited time via updateInheritedTim
e | 118 // When AnimationEffect receives a new inherited time via updateInheritedTim
e |
119 // it will (if necessary) recalculate timings and (if necessary) call | 119 // it will (if necessary) recalculate timings and (if necessary) call |
120 // updateChildrenAndEffects. | 120 // updateChildrenAndEffects. |
121 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const; | 121 void updateInheritedTime(double, TimingUpdateReason) const; |
122 void invalidate() const { m_needsUpdate = true; } | 122 void invalidate() const { m_needsUpdate = true; } |
123 bool requiresIterationEvents() const { return m_eventDelegate && m_eventDele
gate->requiresIterationEvents(*this); } | 123 bool requiresIterationEvents() const; |
124 void clearEventDelegate() { m_eventDelegate = nullptr; } | 124 void clearEventDelegate(); |
125 | 125 |
126 virtual void attach(Animation* animation) | 126 virtual void attach(Animation*); |
127 { | 127 virtual void detach(); |
128 m_animation = animation; | |
129 } | |
130 | |
131 virtual void detach() | |
132 { | |
133 ASSERT(m_animation); | |
134 m_animation = nullptr; | |
135 } | |
136 | 128 |
137 double repeatedDuration() const; | 129 double repeatedDuration() const; |
138 | 130 |
139 virtual void updateChildrenAndEffects() const = 0; | 131 virtual void updateChildrenAndEffects() const = 0; |
140 virtual double intrinsicIterationDuration() const { return 0; } | 132 virtual double intrinsicIterationDuration() const { return 0; } |
141 virtual double calculateTimeToEffectChange(bool forwards, double localTime,
double timeToNextIteration) const = 0; | 133 virtual double calculateTimeToEffectChange(bool forwards, double localTime,
double timeToNextIteration) const = 0; |
142 virtual void specifiedTimingChanged() { } | 134 virtual void specifiedTimingChanged() { } |
143 | 135 |
144 Member<Animation> m_animation; | 136 Member<Animation> m_animation; |
145 Timing m_timing; | 137 Timing m_timing; |
(...skipping 14 matching lines...) Expand all Loading... |
160 mutable bool m_needsUpdate; | 152 mutable bool m_needsUpdate; |
161 mutable double m_lastUpdateTime; | 153 mutable double m_lastUpdateTime; |
162 String m_name; | 154 String m_name; |
163 | 155 |
164 const CalculatedTiming& ensureCalculated() const; | 156 const CalculatedTiming& ensureCalculated() const; |
165 }; | 157 }; |
166 | 158 |
167 } // namespace blink | 159 } // namespace blink |
168 | 160 |
169 #endif // AnimationEffect_h | 161 #endif // AnimationEffect_h |
OLD | NEW |