Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Jan 18, 2024
1 parent d4d2ef6 commit 6d91646
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/svelte/src/internal/client/transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,21 @@ function create_transition(dom, init, direction, effect) {
// If we are working with CSS animations, then before we call reverse, we also need to ensure
// that we reverse the easing logic. To do this we need to re-create the keyframes so they're
// in reverse with easing properly reversed too.
if (payload !== null && payload.css !== undefined) {
if (
payload !== null &&
payload.css !== undefined &&
/** @type {Animation} */ (animation).effect != null
) {
const duration = payload.duration ?? 300;
const css_fn = payload.css;
const easing_fn = payload.easing || linear;
const keyframes = create_keyframes(easing_fn, css_fn, duration, direction, true);
if (/** @type {Animation} */ (animation).effect != null) {
// If we have an existing animation, we need to pause it and create a new animation
// with the new frames.
animation.pause();
create_animation();
// @ts-ignore
animation.effect.setKeyframes(keyframes);
}
// If we have an existing animation, we need to pause it and create a new animation
// with the new frames.
animation.pause();
create_animation();
// @ts-ignore
animation.effect.setKeyframes(keyframes);
}
/** @type {Animation | TickAnimation} */ (animation).reverse();
} else {
Expand Down

0 comments on commit 6d91646

Please sign in to comment.