1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | var easing = require('../easing');
|
6 | var internal = require('../internal');
|
7 |
|
8 | function flip(node, animation, params) {
|
9 | const style = getComputedStyle(node);
|
10 | const transform = style.transform === 'none' ? '' : style.transform;
|
11 | const dx = animation.from.left - animation.to.left;
|
12 | const dy = animation.from.top - animation.to.top;
|
13 | const d = Math.sqrt(dx * dx + dy * dy);
|
14 | const { delay = 0, duration = d => Math.sqrt(d) * 120, easing: easing$1 = easing.cubicOut } = params;
|
15 | return {
|
16 | delay,
|
17 | duration: internal.is_function(duration) ? duration(d) : duration,
|
18 | easing: easing$1,
|
19 | css: (_t, u) => `transform: ${transform} translate(${u * dx}px, ${u * dy}px);`
|
20 | };
|
21 | }
|
22 |
|
23 | exports.flip = flip;
|