diff --git a/packages/svelte/src/motion/spring.js b/packages/svelte/src/motion/spring.js index 6d95f7944d..5615b00f6f 100644 --- a/packages/svelte/src/motion/spring.js +++ b/packages/svelte/src/motion/spring.js @@ -229,7 +229,7 @@ export class Spring { if (!this.#task) { this.#last_time = raf.now(); - var inv_mass_recovery_rate = 1 / (this.#momentum * 60); + var inv_mass_recovery_rate = 1000 / (this.#momentum * 60); this.#task ??= loop((now) => { this.#inverse_mass = Math.min(this.#inverse_mass + inv_mass_recovery_rate, 1); @@ -268,7 +268,7 @@ export class Spring { * If `options.instant` is `true`, `spring.current` immediately matches `spring.target`. * * If `options.preserveMomentum` is provided, the spring will continue on its current trajectory for - * the specified number of seconds. This is useful for things like 'fling' gestures. + * the specified number of milliseconds. This is useful for things like 'fling' gestures. * * @param {T} value * @param {{ instant?: boolean; preserveMomentum?: number }} [options] diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index f494d7bfdd..61098de98a 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -1737,14 +1737,14 @@ declare module 'svelte/motion' { * If `options.instant` is `true`, `spring.current` immediately matches `spring.target`. * * If `options.preserveMomentum` is provided, the spring will continue on its current trajectory for - * the specified number of seconds. This is useful for things like 'fling' gestures. + * the specified number of milliseconds. This is useful for things like 'fling' gestures. * * */ set(value: T, options?: { instant?: boolean; preserveMomentum?: number; - } | undefined): Promise; + } | undefined): Promise; get current(): T; set damping(v: number); get damping(): number;