Manual cleanup of src/runtime/motion/tweened.js

pull/8569/head
S. Elliott Johnson 3 years ago
parent 4b294516a3
commit e798760aa0

@ -1,7 +1,8 @@
import { writable } from '../store'; import { writable } from '../store.js';
import { assign, loop, now } from '../internal'; import { assign, loop, now } from '../internal.js';
import { linear } from '../easing'; import { linear } from '../easing.js';
import { is_date } from './utils'; import { is_date } from './utils.js';
/** @returns {(t: any) => any} */ /** @returns {(t: any) => any} */
function get_interpolator(a, b) { function get_interpolator(a, b) {
if (a === b || a !== a) return () => a; if (a === b || a !== a) return () => a;
@ -42,7 +43,9 @@ function get_interpolator(a, b) {
} }
throw new Error(`Cannot interpolate ${type} values`); throw new Error(`Cannot interpolate ${type} values`);
} }
/** @param {T} value
/**
* @param {T} value
* @param {Options<T>} defaults * @param {Options<T>} defaults
* @returns {import("/Users/elliottjohnson/dev/sveltejs/svelte/tweened.ts-to-jsdoc").Tweened<T>} * @returns {import("/Users/elliottjohnson/dev/sveltejs/svelte/tweened.ts-to-jsdoc").Tweened<T>}
*/ */
@ -51,7 +54,8 @@ export function tweened(value, defaults = {}) {
/** @type {Task} */ /** @type {Task} */
let task; let task;
let target_value = value; let target_value = value;
/** @param {T} new_value /**
* @param {T} new_value
* @param {Options<T>} opts * @param {Options<T>} opts
* @returns {any} * @returns {any}
*/ */
@ -113,7 +117,8 @@ export function tweened(value, defaults = {}) {
* @template T * @template T
*/ */
/** @typedef {Object} Options /**
* @typedef {Object} Options
* @property {number} [delay] * @property {number} [delay]
* @property {number|((from:T,to:T)=>number)} [duration] * @property {number|((from:T,to:T)=>number)} [duration]
* @property {(t:number)=>number} [easing] * @property {(t:number)=>number} [easing]

Loading…
Cancel
Save