Skip to content

Commit 6d91646

Browse files
committed
tweak
1 parent d4d2ef6 commit 6d91646

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/svelte/src/internal/client/transitions.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -440,19 +440,21 @@ function create_transition(dom, init, direction, effect) {
440440
// If we are working with CSS animations, then before we call reverse, we also need to ensure
441441
// that we reverse the easing logic. To do this we need to re-create the keyframes so they're
442442
// in reverse with easing properly reversed too.
443-
if (payload !== null && payload.css !== undefined) {
443+
if (
444+
payload !== null &&
445+
payload.css !== undefined &&
446+
/** @type {Animation} */ (animation).effect != null
447+
) {
444448
const duration = payload.duration ?? 300;
445449
const css_fn = payload.css;
446450
const easing_fn = payload.easing || linear;
447451
const keyframes = create_keyframes(easing_fn, css_fn, duration, direction, true);
448-
if (/** @type {Animation} */ (animation).effect != null) {
449-
// If we have an existing animation, we need to pause it and create a new animation
450-
// with the new frames.
451-
animation.pause();
452-
create_animation();
453-
// @ts-ignore
454-
animation.effect.setKeyframes(keyframes);
455-
}
452+
// If we have an existing animation, we need to pause it and create a new animation
453+
// with the new frames.
454+
animation.pause();
455+
create_animation();
456+
// @ts-ignore
457+
animation.effect.setKeyframes(keyframes);
456458
}
457459
/** @type {Animation | TickAnimation} */ (animation).reverse();
458460
} else {

0 commit comments

Comments
 (0)