securityos/node_modules/framer-motion/dist/es/utils/distance.mjs

10 lines
260 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
const distance = (a, b) => Math.abs(a - b);
function distance2D(a, b) {
// Multi-dimensional
const xDelta = distance(a.x, b.x);
const yDelta = distance(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}
export { distance, distance2D };