motion-v
Version:
<p align="center"> <img width="100" height="100" alt="Motion logo" src="https://user-images.githubusercontent.com/7850794/164965523-3eced4c4-6020-467e-acde-f11b7900ad62.png" /> </p> <h1 align="center">Motion for Vue</h1>
15 lines (14 loc) • 687 B
JavaScript
function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) {
const sortedChildren = Array.from(children).sort((a, b) => a.sortNodePosition(b));
const index = sortedChildren.indexOf(child);
const numChildren = children.size;
const maxStaggerDuration = (numChildren - 1) * staggerChildren;
const delayIsFunction = typeof delayChildren === "function";
if (index === sortedChildren.length - 1) {
child.parent.enteringChildren = void 0;
}
return delayIsFunction ? delayChildren(index, numChildren) : staggerDirection === 1 ? index * staggerChildren : maxStaggerDuration - index * staggerChildren;
}
export {
calcChildStagger
};