Jump to content

Create animation from 2 texture atlases


html5gamedev
 Share

Recommended Posts

            function setupFrames(startName,endName){
                var frames = [];
                for (var i = 0; i < 21; i++) {
                    var val = i < 10 ? '0' + i : i;
                    frames.push(PIXI.Texture.fromFrame(startName + val + '.png'));
                }

                for (var i = 21; i < 40; i++) {
                    var val = i;
                    frames.push(PIXI.Texture.fromFrame(endName + val + '.png'));
                }

                return frames;
            }



//used with
                var anim = new PIXI.extras.AnimatedSprite(setupFrames("rot1","rot2"));
                anim.animationSpeed = 0.5;
                stage.addChild(anim);
                anim.play();

I am trying to create an animation from 2 texture atlases. The problem I am facing is a glitch-a freeze in the middle, when I switch from startName to endName texture. I want to switch between texture atlases, because my textures are quite big, and if I wanted to place all in 1 atlas, it's size would be 20000x20000 px, which is not supported even by desktop machines. 

 

Are there any tricks I can use to eliminate that glitch? Thanks, Tim

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...