I am currently developing a level creator platformer game using Phaser 3 and arcade physics. I have a tilemap that I use for the ground. For animated tiles I have a system where I create sprites at the positions in a grid similar to the tilemap. I have it setup so that when I press "M" on the keyboard, it turns on a "creative" mode and brings all of the sprites back to their initial positions. The issue is that the animations are not in sync and because of that, although the sprites go to the right position, the animation offsets it and the sprites aren't in their grid. I have tried stopping and starting the animation when they reset but it doesn't seem to have much of an effect. Is their a way that I can set them to frame 1 easily? do I need to subtract the current frames offset and use that to position them?
Well I'm not 100%, if this is the solution you are looking for, but with sprite.setFrame(...) (link to documentation) you can set the frame of a sprite to a specific FrameIndex, and with this.anims.get(...).frames[0].textureFrame) (link to Docs) you could get the first frame of a specific animation.
So you could theoretically, do something like:
sprite.setFrame(this.anims.get(animationName).frames[0].textureFrame)
or if you just want to set the first frame of the current animation(link to documentation). Seting the progress to 0 sets the frame to the first frame, of the current animation.
sprite.anims.currentAnim.getFrameByProgress(0);