MCPcopy
hub / github.com/animatedjs/animated / sequence

Function sequence

src/index.js:160–195  ·  view source on GitHub ↗
(
  animations: Array<CompositeAnimation>,
)

Source from the content-addressed store, hash-verified

158};
159
160var sequence = function(
161 animations: Array<CompositeAnimation>,
162): CompositeAnimation {
163 var current = 0;
164 return {
165 start: function(callback?: ?EndCallback) {
166 var onComplete = function(result) {
167 if (!result.finished) {
168 callback && callback(result);
169 return;
170 }
171
172 current++;
173
174 if (current === animations.length) {
175 callback && callback(result);
176 return;
177 }
178
179 animations[current].start(onComplete);
180 };
181
182 if (animations.length === 0) {
183 callback && callback({finished: true});
184 } else {
185 animations[current].start(onComplete);
186 }
187 },
188
189 stop: function() {
190 if (current < animations.length) {
191 animations[current].stop();
192 }
193 }
194 };
195};
196
197type ParallelConfig = {
198 stopTogether?: bool; // If one is stopped, stop all. default: true

Callers 1

staggerFunction · 0.85

Calls 2

startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…