* @param {HTMLElement} target * @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes * @param {number | KeyframeAnimationOptions | undefined} options
(target, keyframes, options)
| 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; |