Creates a signal whose value morphs from the old value to the new over a specified duration.
Param: source
Either a value, signal, observable, or function that can be used in a computed function.
Param: options
Options for the signal. If a number, number[] or Record<string | number symbol, number>
is passed then this is not required. Otherwise an interpolator is required to translate the change of the value.
Example
constfastLinearChange = tweenSignal(1); constslowEaseInChange = tweenSignal(1, { duration:5000, easing:easeInQuad }); functiondemo(): void { fastLinearChange.set(5); // in 400ms will display something like 1, 1.453, 2.134, 3.521, 4.123, 5. slowEaseInChange.set(5, { duration:10000 }); // in 10000ms will display something like 1, 1.21, 1.4301... }
Creates a signal whose value morphs from the old value to the new over a specified duration.
Param: source
Either a value, signal, observable, or function that can be used in a computed function.
Param: options
Options for the signal. If a number, number[] or Record<string | number symbol, number> is passed then this is not required. Otherwise an interpolator is required to translate the change of the value.
Example