UNPKG

motion-plus-vue

Version:

Motion Plus Vue

14 lines (13 loc) 489 B
import { wrap as s } from "motion-v"; function C(f, n, r, x) { const e = -f, o = x === null ? Math.floor(e / r) : 0, a = o * r; for (let t = n.length - 1; t >= 0; t--) { const c = n[t] + a, h = s(0, n.length, t - 1), v = (t === 0 ? o - 1 : o) * r, i = n[h] + v, m = (c - i) / 2, u = s(0, n.length, t + 1), T = (t === n.length - 1 ? o + 1 : o) * r, l = n[u] + T, I = (l - c) / 2; if (e < l - I && e >= i + m) return t; } return 0; } export { C as calcCurrentPage };