How to control animation frames order

There is an animated sprite with animationupdate event handler:

sprite.on('animationupdate', (anim, frame) => onAnimationUpdateHandler(sprite, anim, frame));

How I can change current frame on started animation inside that event handler?

I found a setCurrentFrame method in Phaser Docs (Phaser 3 API Documentation - Class: Animation), but I do not understand how to use it.

What are you trying to do overall?

Possible you want to use the startAt argument in play() instead.

I need to change frames order from “1-2-3-4-5-6”
to “1-2-3-4-3-4-3-4-5-6” (e.g.) in some cases.
New frames order can be different and depends on algorithm.

sprite.anims.setCurrentFrame(anim.getFrameAt(index));

Thanks!
Method getFrameAt is private, but it’s nothing.