On frame update callback

Hi, I did not read the forum, so if the answer to my question already exists, then please excuse me. I would like to know how I can call a callback for a specific frame. On the Phaser 3 Example page, I see a callback just for the whole animation, thanks!

https://labs.phaser.io/edit.html?src=src\animation\on%20update%20callback.js

I think that example may be obsolete. You would use maybe SPRITE_ANIMATION_KEY_UPDATE event instead.

I understand correctly that this event should be set to create functions?

Something like

sprite.on('animationupdate-KEY', function (anim, frame) {
  if (frame.index === INDEX) {
    // …
  }
});
1 Like

I may have found another obsolete example Callback Parameters

But according to the anims config it doesn’t have an “onRepeat” parameter.