UNPKG

@marigoldapp/svelte-calendar

Version:

A small date picker built with Svelte 3. Demo available here: [demo page].

33 lines (29 loc) 937 B
import { N as identity } from '../common/index-7e65c21e.js'; function cubicOut(t) { const f = t - 1.0; return f * f * f + 1.0; } function fade(node, { delay = 0, duration = 400, easing = identity }) { const o = +getComputedStyle(node).opacity; return { delay, duration, easing, css: t => `opacity: ${t * o}` }; } function fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 }) { const style = getComputedStyle(node); const target_opacity = +style.opacity; const transform = style.transform === 'none' ? '' : style.transform; const od = target_opacity * (1 - opacity); return { delay, duration, easing, css: (t, u) => ` transform: ${transform} translate(${(1 - t) * x}px, ${(1 - t) * y}px); opacity: ${target_opacity - (od * u)}` }; } export { fade, fly };