*Createsaneventdispatcherthatcanbeusedtodispatch[componentevents](https://svelte.dev/docs#template-syntax-component-directives-on-eventname). Event dispatchers are functions that can take two arguments: `name` and `detail`.
*
*Componenteventscreatedwith`createEventDispatcher`createa[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture) and are not cancellable with `event.preventDefault()`. The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) property and can contain any type of data.
*Aswith[`tweened`](https://svelte.dev/docs#run-time-svelte-motion-tweened) stores, `set` and `update` return a Promise that resolves if the spring settles. The `store.stiffness` and `store.damping` properties can be changed while the spring is in motion, and will take immediate effect.
*(`function`)—itallowsyoutotweenbetween*any*arbitraryvalues.Itmustbean`(a, b) => t => value`function,where`a`isthestartingvalue,`b`isthetargetvalue,`t`isanumberbetween0and1,and`value`istheresult.Forexample,wecanusethe[d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours
*The`interpolate`optionallowsyoutotweenbetween*any*arbitraryvalues.Itmustbean`(a, b) => t => value`function,where`a`isthestartingvalue,`b`isthetargetvalue,`t`isanumberbetween0and1,and`value`istheresult.Forexample,wecanusethe[d3-interpolate](https://github.com/d3/d3-interpolate) package to smoothly interpolate between two colours.
@ -62,14 +168,63 @@ export function fade(node: Element, {
}
exportinterfaceFlyParams{
/** (`number`, default 0) — milliseconds before starting */
delay?: number;
/** (`number`, default 400) — milliseconds the transition lasts */
duration?: number;
/** (`function`, default `cubicOut`) — an [easing function](https://svelte.dev/docs#run-time-svelte-easing) */
easing?: EasingFunction;
/** (`number`, default 0) - the x offset to animate out to and in from */
x?: number;
/** (`number`, default 0) - the y offset to animate out to and in from */
y?: number;
/** (`number`, default 0) - the opacity value to animate out to and in from */
opacity?: number;
}
/**
*
*```html
*transition:fly={params}
*```
*```html
*in:fly={params}
*```
*```html
*out:fly={params}
*```
*
*---
*
*Animatesthexandypositionsandtheopacityofanelement.`in`transitionsanimatefromanelement's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element'sdefaultvalues.
@ -133,13 +329,57 @@ export function slide(node: Element, {
}
exportinterfaceScaleParams{
/** (`number`, default 0) — milliseconds before starting */
delay?: number;
/** (`number`, default 400) — milliseconds the transition lasts */
duration?: number;
/** (`function`, default `cubicOut`) — an [easing function](https://svelte.dev/docs#run-time-svelte-easing) */
easing?: EasingFunction;
/** (`number`, default 0) - the scale value to animate out to and in from */
start?: number;
/** (`number`, default 0) - the opacity value to animate out to and in from */
opacity?: number;
}
/**
*
*```html
*transition:scale={params}
*```
*```html
*in:scale={params}
*```
*```html
*out:scale={params}
*```
*
*---
*
*Animatestheopacityandscaleofanelement.`in`transitionsanimatefromanelement's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element'sdefaultvalues.
/** (`function`, default `cubicOut`) — an [easing function](https://svelte.dev/docs#run-time-svelte-easing) */
easing?: EasingFunction;
/** (`function`) — A fallback [transition](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) to use for send when there is no matching element being received, and for receive when there is no element being sent. */
*The`crossfade`functioncreatesapairof[transitions](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
**`fallback`(`function`)—Afallback[transition](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) to use for send when there is no matching element being received, and for receive when there is no element being sent.