|
|
@ -358,6 +358,7 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
|
var duration = /** @type {number} */ (options.duration) * Math.abs(delta);
|
|
|
|
var duration = /** @type {number} */ (options.duration) * Math.abs(delta);
|
|
|
|
var keyframes = [];
|
|
|
|
var keyframes = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (duration > 0) {
|
|
|
|
if (css) {
|
|
|
|
if (css) {
|
|
|
|
var n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value
|
|
|
|
var n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value
|
|
|
|
|
|
|
|
|
|
|
@ -368,14 +369,6 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
animation = element.animate(keyframes, { duration, fill: 'forwards' });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
animation.onfinish = () => {
|
|
|
|
|
|
|
|
get_t = () => t2;
|
|
|
|
|
|
|
|
tick?.(t2, 1 - t2);
|
|
|
|
|
|
|
|
on_finish();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_t = () => {
|
|
|
|
get_t = () => {
|
|
|
|
var time = /** @type {number} */ (
|
|
|
|
var time = /** @type {number} */ (
|
|
|
|
/** @type {globalThis.Animation} */ (animation).currentTime
|
|
|
|
/** @type {globalThis.Animation} */ (animation).currentTime
|
|
|
@ -394,6 +387,15 @@ function animate(element, options, counterpart, t2, on_finish) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
animation = element.animate(keyframes, { duration, fill: 'forwards' });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
animation.onfinish = () => {
|
|
|
|
|
|
|
|
get_t = () => t2;
|
|
|
|
|
|
|
|
tick?.(t2, 1 - t2);
|
|
|
|
|
|
|
|
on_finish();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|