I just figured a bit silly way to address this in AnimatedSprite since I just encountered the same problem, not sure if it will work for your AnimationPlayer.
The trick is to create as same number of animations as sprites, or frame you have, then load different sprite textures one by one into in each trail. Now you have one animation for one trail.
Then, in the script, you use "$Trail.emitting = true/false" to enable different trails you want to have in a certain moment. Remember to disable the rest completely and save the one you want to the display, and you could make if functions or for loop to make different conditions for which to frame of trail to display.
For example, mine is a pretty simple code:
if velocity.x != 0:
$AnimatedSprite.flip_v = false
if velocity.x > 0:
$Trailup.emitting = false
$Trailleft.emitting = false
$Trailback.emitting = false
$AnimatedSprite.animation = "right"
$Trailright.emitting = true
elif velocity.x < 0:
$Trailup.emitting = false
$Trailback.emitting = false
$Trailright.emitting = false
$AnimatedSprite.animation = "left"
$Trailleft.emitting = true
elif velocity.y != 0:
if velocity.y > 0:
$Trailback.emitting = false
$Trailright.emitting = false
$Trailleft.emitting = false
$AnimatedSprite.animation = "up"
$Trailup.emitting = true
elif velocity.y < 0:
$Trailup.emitting = false
$Trailright.emitting = false
$Trailleft.emitting = false
$AnimatedSprite.animation = "back"
$Trailback.emitting = true
I created 4 trails for my four animations.
I hope this can help :)