pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.25k stars 173 forks source link

Ensure if AnimatedSprite is playing and textures are switched it continues to play #382

Open baseten opened 1 year ago

baseten commented 1 year ago

Original Issue: https://github.com/pixijs/pixi-react/issues/359 See also: https://github.com/orgs/pixijs/projects/6/views/1?pane=issue&itemId=18775677

baseten commented 1 year ago

Stopping after texture change is actually the functionality straight from PIXI: https://github.com/pixijs/pixijs/blob/dev/packages/sprite-animated/src/AnimatedSprite.ts#L389

I'm wary of making changes which diverge from how PIXI itself works, but this poses a challenge as it means the React state of isPlaying becomes out of sync with AnimatedSprite's internal state. A callback onPlayingChanged may be the best solution although I appreciate it also isn't optimal.