|
|
|
|
@ -111,6 +111,7 @@ export function slide(node: Element, {
|
|
|
|
|
const style = getComputedStyle(node);
|
|
|
|
|
const opacity = +style.opacity;
|
|
|
|
|
const primary_property = axis === 'y' ? 'height' : 'width';
|
|
|
|
|
const min_primary_property = `min-${primary_property}`;
|
|
|
|
|
const primary_property_value = parseFloat(style[primary_property]);
|
|
|
|
|
const secondary_properties = axis === 'y' ? ['top', 'bottom'] : ['left', 'right'];
|
|
|
|
|
const capitalized_secondary_properties = secondary_properties.map((e) => `${e[0].toUpperCase()}${e.slice(1)}`);
|
|
|
|
|
@ -128,6 +129,7 @@ export function slide(node: Element, {
|
|
|
|
|
'overflow: hidden;' +
|
|
|
|
|
`opacity: ${Math.min(t * 20, 1) * opacity};` +
|
|
|
|
|
`${primary_property}: ${t * primary_property_value}px;` +
|
|
|
|
|
`${min_primary_property}: 0;` +
|
|
|
|
|
`padding-${secondary_properties[0]}: ${t * padding_start_value}px;` +
|
|
|
|
|
`padding-${secondary_properties[1]}: ${t * padding_end_value}px;` +
|
|
|
|
|
`margin-${secondary_properties[0]}: ${t * margin_start_value}px;` +
|
|
|
|
|
|