add scale transition. closes #2380

pull/2381/head
Rich Harris 6 years ago
parent b9aa8912e6
commit 66d6feb8ef

@ -409,7 +409,7 @@ As with `tweened` stores, `set` and `update` return a Promise that resolves if t
TODO
* fade, fly, slide, draw
* fade, fly, slide, scale, draw
* crossfade...
### svelte/animation

@ -66,6 +66,32 @@ export function slide(node, {
};
}
export function scale(node, {
delay = 0,
duration = 400,
easing = cubicOut,
start = 0,
opacity = 0
}) {
const sd = 1 - start;
const od = 1 - opacity;
const transform = (
node.style.transform ||
getComputedStyle(node).transform
).replace('none', '');
return {
delay,
duration,
easing,
css: (t, u) => `
transform: ${transform} scale(${1 - (sd * u)});
opacity: ${1 - (od * u)}
`
};
}
export function draw(node, {
delay = 0,
duration = 800,

Loading…
Cancel
Save