Herbert Posted July 2, 2018 Share Posted July 2, 2018 hi guys, How can I make a spine keep checking onComplete Event while losing tab focus? As I tested, if I run several spine animations(different length) at the same time, then switch to another tab immediately, the onComplete events won't fire, but they will fire at once when the tab get focus again. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 2, 2018 Share Posted July 2, 2018 First, study how pixi ticker works, and how it is based on RaF. Second, look how pixi-spine manages updates from updateTransform(). Third, research if its possible to call updates on all spine objects (or just updateTransform on root?) from your own custom setInterval handler. Quote Link to comment Share on other sites More sharing options...
Herbert Posted July 3, 2018 Author Share Posted July 3, 2018 hi @ivan.popelyshev, Thanks for your hints, I got it works by calling updateTransform of all spines in my custom setInterval which will keep firing on blur. something like createSpine(data, opts) { const spine = new PIXI.spine.Spine(data, opts); this.updateList.push(spine); return spine; } updateOnBlur() { // update animatedSprite PIXI.ticker.shared.update(); // update spine this.updateList.forEach(spine => spine.updateTransform()); } I am wondering is there any setting that I can apply shared ticker to all spines, so I don't need to store them in an array. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 3, 2018 Share Posted July 3, 2018 dont forget to remove them when its needed, or you'll get memory leak. Well, you can just call updateTransform on whole stage and not list of spine objects, however you need a temporary parent for it (or get NullPointerException), like WebGLRenderer or CanvasRenderer does , please look inside pixi sources. Or you can call updateTransform of all direct children of the stage. https://github.com/pixijs/pixi.js/blob/dev/src/core/renderers/webgl/WebGLRenderer.js#L309 Herbert 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.