@hakit/components
Version:
A series of components to work with @hakit/core
17 lines (16 loc) • 746 B
JavaScript
const f = ([[t, s], [c, o]], [a, r]) => [t * a + s * r, c * a + o * r], j = (t) => [[Math.cos(t), -Math.sin(t)], [Math.sin(t), Math.cos(t)]], p = ([t, s], [c, o]) => [t + c, s + o], i = (t) => t / 180 * Math.PI, u = (t) => {
const {
x: s,
y: c,
r: o,
start: a,
end: r,
rotate: x = 0
} = t, d = s, I = c, e = o, h = o, n = i(a), M = (i(r) - n) % (2 * Math.PI), P = i(x), A = j(P), [y, R] = p(f(A, [e * Math.cos(n), h * Math.sin(n)]), [d, I]), [V, X] = p(f(A, [e * Math.cos(n + M), h * Math.sin(n + M)]), [d, I]), Y = M > Math.PI ? 1 : 0, g = M > 0 ? 1 : 0;
return ["M", y, R, "A", e, h, P / (2 * Math.PI) * 360, Y, g, V, X].join(" ");
};
export {
u as svgArc,
i as toRadian
};
//# sourceMappingURL=svg-arc.js.map