Jump to content

What is the best way to implement pixi.js game/app loop?


Gorgi Kakasevski
 Share

Recommended Posts

Hi everyone. Although I found many articles about game loop, requestAnimationFrame, delta time etc. I want to ask you here what is the best way to implement it. As a "game loop" I understand the code which should execute several times per second non-stop, even if a user switch between the tabs in the browser. I found this library https://github.com/kittykatattack/smoothie, in which you can specify your frame rate which is independent from requestAnimationFrame, but update() function stops when user switch between tabs.

Any help, recommendation, or a plugin for best solution?

p.s. Simple example will be great.

Link to comment
Share on other sites

On 8/11/2016 at 2:28 PM, Exca said:

 

On 8/11/2016 at 2:34 PM, ivan.popelyshev said:

@Exca which also uses RAF :)

As I saw its implementation is based on RAF. I try it with simple example and the animation is stopped when I change the tab:

ticker.add(function (time) {
        console.log(z++);        
        drawBackground();
        renderer.render(stage);
});

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