MCPcopy Index your code
hub / github.com/ptmt/react-native-macos / sequence

Function sequence

Libraries/Animated/src/AnimatedImplementation.js:2151–2203  ·  view source on GitHub ↗
(
  animations: Array<CompositeAnimation>,
)

Source from the content-addressed store, hash-verified

2149};
2150
2151var sequence = function(
2152 animations: Array<CompositeAnimation>,
2153): CompositeAnimation {
2154 var current = 0;
2155 return {
2156 start: function(callback?: ?EndCallback) {
2157 var onComplete = function(result) {
2158 if (!result.finished) {
2159 callback && callback(result);
2160 return;
2161 }
2162
2163 current++;
2164
2165 if (current === animations.length) {
2166 callback && callback(result);
2167 return;
2168 }
2169
2170 animations[current].start(onComplete);
2171 };
2172
2173 if (animations.length === 0) {
2174 callback && callback({finished: true});
2175 } else {
2176 animations[current].start(onComplete);
2177 }
2178 },
2179
2180 stop: function() {
2181 if (current < animations.length) {
2182 animations[current].stop();
2183 }
2184 },
2185
2186 reset: function() {
2187 animations.forEach((animation, idx) => {
2188 if (idx <= current) {
2189 animation.reset();
2190 }
2191 });
2192 current = 0;
2193 },
2194
2195 _startNativeLoop: function() {
2196 throw new Error('Loops run using the native driver cannot contain Animated.sequence animations');
2197 },
2198
2199 _isUsingNativeDriver: function(): boolean {
2200 return false;
2201 }
2202 };
2203};
2204
2205type ParallelConfig = {
2206 stopTogether?: bool, // If one is stopped, stop all. default: true

Callers 1

staggerFunction · 0.85

Calls 4

callbackFunction · 0.50
startMethod · 0.45
stopMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…