Jump to content

Freeze of an animation while loading/preloading textures pixijs


Wlader
 Share

Recommended Posts

Hi! Maybe someone could help  with a freeze of an animation while we loading/preloading textures.

There are background and several big animations. 

After scene have started to change and transition animation have started, main container is cleared and new background with different big animations are added.

This freeze is connected with scene rendering.

Does somebody know the way to deal with this problem?

=======================

Version pixijs 6.2.2

=======================

Application

    

    virtual_h = 2276;
    virtual_w = 1280;
    
    render = PIXI.autoDetectRenderer(virtual_w, virtual_h, {
        resolution: window.devicePixelRatio,
        autoResize: true,
        antialias: false,
    });
    
    gameContainer.height = virtual_h;
    gameContainer.width = virtual_w;
    document.getElementById("game").appendChild(render.view);

=======================

Animation

    let animationRaw = PIXI.Loader.shared.resources["animationRaw"].spritesheet.animations["animationRaw"];
    
    let animation = new PIXI.AnimatedSprite(animationRaw);
    animation.autoUpdate = true;
    animation.loop = false;
    animation.onComplete = function() {
        animation.stop();
    };
    gameContainer.addChild(animation);

=======================

Preload

    render.plugins.prepare.upload(gameContainer);

=======================

Ticker

    ticker.add(function() {
        render.render(gameContainer);
    });

=======================

Switch a scene

gameContainer.removeChildren(0, gameContainer.children.length);
    
    let animationRawNew = PIXI.Loader.shared.resources["animationRawNew"].spritesheet.animations["animationRawNew"];
    
    let animationNew = new PIXI.AnimatedSprite(animationRawNew);
    animationNew.autoUpdate = true;
    animationNew.loop = false;
    animationNew.onComplete = function() {
        animationNew.stop();
    };
    gameContainer.addChild(animationNew);


=======================

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...