frontend/.pnpm-store/v3/files/74/e65821f7a82f9ad4104d5d9ce85f1281053a823b7bb6a5ea6d0ed3fcb4fa83cb6f539d00f0041722e021827d48199401ff0ee6b6f1540ecfc4d0fbf716e918

26 lines
986 B
Plaintext

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var easing = require('../easing/index.js');
var internal = require('../internal/index.js');
function flip(node, animation, params = {}) {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
const scaleX = animation.from.width / node.clientWidth;
const scaleY = animation.from.height / node.clientHeight;
const dx = (animation.from.left - animation.to.left) / scaleX;
const dy = (animation.from.top - animation.to.top) / scaleY;
const d = Math.sqrt(dx * dx + dy * dy);
const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing: easing$1 = easing.cubicOut } = params;
return {
delay,
duration: internal.is_function(duration) ? duration(d) : duration,
easing: easing$1,
css: (_t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
};
}
exports.flip = flip;