ravinesstream Posted January 10, 2019 Share Posted January 10, 2019 I've loaded two animations in Pixi with spritesheets. I wanna swap to second animation right after the first animation is finished. Quote animation0.onComplete = function() { // animation0 and animation1 are two animatedSprite while animation0.loop = false and animation1.loop = true animation0.renderable = false; animation1.gotoAndPlay(0); animation1.x = 100; animation1.y = 100; animation1.renderable = true; } However, (It's happen with a 3840x1080 resolution, and the GPU memory usage is mainly fall between 90%-99%) 1. there's a significant lag of the transition between these two animations in the first time. 2. After the first play, if I remove and add the animatedSprite from the stage immediately, the transition is very smooth. 3. After the first play, If I remove the 2 animatedSprite from the stage, wait for ~2-3 minutes and add the 2 animatedSprite into the stage again, the transition is lagging again. I wanna know the proper way of swapping two animation in Pixi and also the reason of this phenomenon. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 10, 2019 Share Posted January 10, 2019 Texture upload to videomemory lags. After 2-3 minutes of not drawing particular texture, pixi GC unloads it. Use `prepare` plugin and turn off the Gc. http://pixijs.download/dev/docs/PIXI.prepare.html http://pixijs.download/dev/docs/PIXI.settings.html#.GC_MODE https://github.com/pixijs/pixi.js/blob/v4.x/src/core/renderers/webgl/TextureGarbageCollector.js ravinesstream 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.