pull/10798/head
Rich Harris 2 years ago
parent 2ee9f2f3f9
commit 865f526fa9

@ -181,7 +181,6 @@ export function transition(flags, element, get_fn, get_params) {
.catch(noop); .catch(noop);
} else { } else {
// Timer // Timer
let running = true;
const start_time = raf.now() + delay; const start_time = raf.now() + delay;
const start_p = p; const start_p = p;
const end_time = start_time + adjusted_duration; const end_time = start_time + adjusted_duration;
@ -189,21 +188,21 @@ export function transition(flags, element, get_fn, get_params) {
// tick?.(p, 1 - p); // TODO put in nested effect, to avoid interleaved reads/writes? // tick?.(p, 1 - p); // TODO put in nested effect, to avoid interleaved reads/writes?
current_task = loop((now) => { current_task = loop((now) => {
if (running) { if (now >= end_time) {
if (now >= end_time) { p = target;
p = target; tick?.(target, 1 - target);
tick?.(target, 1 - target); current_task = current_options = null;
current_task = current_options = null; callbacks.forEach(run);
callbacks.forEach(run); dispatch_event(element, target === 1 ? 'introend' : 'outroend');
dispatch_event(element, target === 1 ? 'introend' : 'outroend'); return false;
return (running = false);
}
if (now >= start_time) {
p = start_p + current_delta * easing((now - start_time) / adjusted_duration);
tick?.(p, 1 - p);
}
} }
return running;
if (now >= start_time) {
p = start_p + current_delta * easing((now - start_time) / adjusted_duration);
tick?.(p, 1 - p);
}
return true;
}); });
} }
} }

Loading…
Cancel
Save