Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animations resume in future on page visibility change #730

Closed
merixstudio opened this issue Apr 16, 2014 · 1 comment
Closed

Animations resume in future on page visibility change #730

merixstudio opened this issue Apr 16, 2014 · 1 comment

Comments

@merixstudio
Copy link

If we're not doing something wrong, then this is a bug, but we are not really sure, so please investigate further.

When game loses focus and then gains it back, all animations skip frames (as if they have never paused). They pause correctly, but they use Game.time.now to check for next frame and it seems that Game.time.now is not reset after page focus gain.

We think that this code in time/Time.js should be corrected:

    gameResumed: function () {
        ...
        //  Level out the elapsed timer to avoid spikes
        this.time = Date.now();
        ...
    },

And this seems to work:

    gameResumed: function () {
        ...
        //  Level out the elapsed timer to avoid spikes
        this.time = this.now = Date.now();  // Reseting this.now also.
        ...
    },

Thanks for your time!

@photonstorm
Copy link
Collaborator

Thanks for this. The fix is now in the 2.0.4 dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant