@@ -445,16 +445,23 @@ function create_transition(dom, init, direction, effect) {
445445 payload . css !== undefined &&
446446 /** @type {Animation } */ ( animation ) . effect != null
447447 ) {
448+ const transform = getComputedStyle ( dom ) . transform ;
448449 const duration = payload . duration ?? 300 ;
449450 const css_fn = payload . css ;
450451 const easing_fn = payload . easing || linear ;
451- const keyframes = create_keyframes ( easing_fn , css_fn , duration , direction , true ) ;
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 ( ) ;
452+ const current_time = animation . currentTime ;
453+
454+ const keyframes = create_keyframes (
455+ easing_fn ,
456+ css_fn ,
457+ current_time ,
458+ direction ,
459+ true
460+ ) ;
461+ animation . duration = current_time ;
456462 // @ts -ignore
457463 animation . effect . setKeyframes ( keyframes ) ;
464+ animation . currentTime = 0 ;
458465 }
459466 /** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
460467 } else {
@@ -655,7 +662,9 @@ export function trigger_transitions(transitions, target_direction, from) {
655662 }
656663 } else {
657664 if ( direction === 'out' || direction === 'both' ) {
658- transition . p = transition . i ( ) ;
665+ if ( ! transition . p ) {
666+ transition . p = transition . i ( ) ;
667+ }
659668 outros . push ( transition . o ) ;
660669 }
661670 transition . d . inert = true ;
0 commit comments