motion
Version:
The Motion library for the web
17 lines (14 loc) • 440 B
JavaScript
import { progress, mix } from 'popmotion';
function fillOffset(offset, remaining) {
const min = offset[offset.length - 1];
for (let i = 1; i <= remaining; i++) {
const offsetProgress = progress(0, remaining, i);
offset.push(mix(min, 1, offsetProgress));
}
}
function defaultOffset(length) {
const offset = [0];
fillOffset(offset, length - 1);
return offset;
}
export { defaultOffset, fillOffset };