framer-motion
Version:
A simple and powerful JavaScript animation library
20 lines (17 loc) • 858 B
JavaScript
import { GroupAnimationWithThen } from 'motion-dom';
import { createAnimationsFromSequence } from '../../sequence/create.mjs';
import { addAnimationDefinitions, startAnimationDefinitions } from './animate-elements.mjs';
function animateSequence(definition, options) {
/**
* Build every element's animations before starting any, so all
* elements' keyframes are read in one pass rather than one read
* after each element's write.
*/
const animationDefinitions = [];
createAnimationsFromSequence(definition, options).forEach(({ keyframes, transition }, element) => {
addAnimationDefinitions(animationDefinitions, element, keyframes, transition);
});
return new GroupAnimationWithThen(startAnimationDefinitions(animationDefinitions));
}
export { animateSequence };
//# sourceMappingURL=animate-sequence.mjs.map