UNPKG

ts-useful

Version:

Functions for animation, color transitions, ecliptic, bezier, decasteljau, curves, three dimensional curves, smooth scrolling, random range, randomItem, mobius index, vectors, physics vectors, and easing.

16 lines 564 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateStep = void 0; const calculateStep = (items, percent) => { percent = Math.max(Math.min(1, percent), 0); const progress = ((items.length - 1) * percent); const index = Math.floor(progress); const pct = (progress - index); return { percent: pct, current: items[index], next: percent === 1 ? items[index] : items[index + 1] }; }; exports.calculateStep = calculateStep; //# sourceMappingURL=calculateStep.js.map