MCPcopy
hub / github.com/sveltejs/svelte / of

Method of

packages/svelte/src/motion/tweened.js:220–228  ·  view source on GitHub ↗

* Create a tween whose value is bound to the return value of `fn`. This must be called * inside an effect root (for example, during component initialisation). * * ```svelte * * import { Tween } from 'svelte/motion'; * * let { number } = $props(); * * const tween = Tween

(fn, options)

Source from the content-addressed store, hash-verified

218 * @param {TweenOptions<U>} [options]
219 */
220 static of(fn, options) {
221 const tween = new Tween(fn(), options);
222
223 render_effect(() => {
224 tween.set(fn());
225 });
226
227 return tween;
228 }
229
230 /**
231 * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it.

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
render_effectFunction · 0.90
fnFunction · 0.50

Tested by

no test coverage detected