@@ -445,16 +445,23 @@ function create_transition(dom, init, direction, effect) {
445
445
payload . css !== undefined &&
446
446
/** @type {Animation } */ ( animation ) . effect != null
447
447
) {
448
+ const transform = getComputedStyle ( dom ) . transform ;
448
449
const duration = payload . duration ?? 300 ;
449
450
const css_fn = payload . css ;
450
451
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 ;
456
462
// @ts -ignore
457
463
animation . effect . setKeyframes ( keyframes ) ;
464
+ animation . currentTime = 0 ;
458
465
}
459
466
/** @type {Animation | TickAnimation } */ ( animation ) . reverse ( ) ;
460
467
} else {
@@ -655,7 +662,9 @@ export function trigger_transitions(transitions, target_direction, from) {
655
662
}
656
663
} else {
657
664
if ( direction === 'out' || direction === 'both' ) {
658
- transition . p = transition . i ( ) ;
665
+ if ( ! transition . p ) {
666
+ transition . p = transition . i ( ) ;
667
+ }
659
668
outros . push ( transition . o ) ;
660
669
}
661
670
transition . d . inert = true ;
0 commit comments