Lag on the first play when swapping animation using onComplete callback in PIXI animatedSprite from two spritesheets

Recommended Posts

I've loaded two animations in Pixi with spritesheets. I wanna swap to second animation right after the first animation is finished.

animation0.onComplete = function() { // animation0 and animation1 are two animatedSprite while animation0.loop = false and animation1.loop = true
    animation0.renderable = false;
    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.

Share this post

Link to post
Share on other sites

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.




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.