useTweenMemo

exactly like useMemo but interpolates computed values between renders using physics based animations

Usage

const [const count: numbercount, const setCount: (value: Kaioken.StateSetter<number>) => voidsetCount] = useState<number>(initial: number | (() => number)): readonly [number, (value: Kaioken.StateSetter<number>) => void]useState(0)
const const tweenCount: TweenSignal<number>tweenCount = useTweenMemo<number>(factory: () => number, deps: unknown[], options?: TweenedOptions<number> | undefined): TweenSignal<number>useTweenMemo(() => const count: numbercount, [const count: numbercount])

Type definition

interface TweenedOptions<T> {
  delay?: number
  duration?: number | ((from: T, to: T) => number)
  easing?: (t: number) => number
  interpolate?: (a: T, b: T) => (t: number) => T
}