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

Method constructor

packages/svelte/tests/animation-helpers.js:62–79  ·  view source on GitHub ↗

* @param {HTMLElement} target * @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes * @param {number | KeyframeAnimationOptions | undefined} options

(target, keyframes, options)

Source from the content-addressed store, hash-verified

60 * @param {number | KeyframeAnimationOptions | undefined} options
61 */
62 constructor(target, keyframes, options) {
63 this.target = target;
64 this.#keyframes = Array.isArray(keyframes) ? keyframes : [];
65 if (typeof options === 'number') {
66 this.#duration = options;
67 this.#delay = 0;
68 } else {
69 const { duration = 0, delay = 0 } = options ?? {};
70 if (typeof duration === 'object') {
71 this.#duration = 0;
72 } else {
73 this.#duration = Math.round(+duration);
74 }
75 this.#delay = delay;
76 }
77
78 this._update();
79 }
80
81 _update() {
82 this.currentTime = raf.time - this.#offset - this.#delay;

Callers

nothing calls this directly

Calls 1

_updateMethod · 0.95

Tested by

no test coverage detected