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

TweenManager.frameBased not working as expected #2178

Closed
mariogarranz opened this issue Oct 29, 2015 · 3 comments
Closed

TweenManager.frameBased not working as expected #2178

mariogarranz opened this issue Oct 29, 2015 · 3 comments

Comments

@mariogarranz
Copy link

According to the docs, the frameBased property works like this:

A frame based tween will use the physics elapsed timer when updating. This means it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should be given in frames.

If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween has actually been through. For very short tweens you may wish to experiment with a frame based update instead

However, in practice it seems like the only way to have tweens running for a fixed amount of time regardless of the device speed is setting frameBased to true.

There are a couple of threads on the forms about it:

http://www.html5gamedevs.com/topic/18183-tweenmanagerframebased-not-working-as-expected/
http://www.html5gamedevs.com/topic/18242-tweens-duration-different-on-different-machines/

@steven-bowdridge
Copy link

Confirming that I see the same erroneous behaviour: by default, a 2000ms tween does not last exactly 2 seconds; it is dependent on frame rate.

This can be demonstrated with the Phaser 'Slow Down Time' example: http://phaser.io/examples/v2/time/slow-down-time
On v2.4.1 and later, lowering the suggestedFps slider will slow down the tween motion even though it is set to complete at 500ms and frameBased is false. The motion is correct with v2.2.2 though. This is a regression defect.

Debugging the issue it appears this.game.time.elapsedMS used in TweenData#update with time based updating is providing erroneous values that ignore frame rate:
https://github.com/photonstorm/phaser/blob/v2.4.6/src/tween/TweenData.js#L363

I suggest setting game.tweens.frameBased = true. The default behaviour produces erroneous tweens.

@photonstorm
Copy link
Collaborator

Thank you for taking the time to open this issue. However, official support for Phaser 2 has now ended as we focus on preparing Phaser 3 for beta release. In a bid to keep the project tidy, and avoid confusion, we are closing all v2 related issues.

This does not mean your issue won't be looked-at. In November 2016 the Phaser CE (Community Edition) project began. The aim of Phaser CE was to allow the community to continue v2 development. Since then it has gained significant traction, with many updates and releases.

If you are still interested in having your issue investigated we strongly recommend testing the latest Phaser CE release. And only if the problem persists, opening an issue on the Phaser CE repo.

@photonstorm
Copy link
Collaborator

This issue has been mentioned on Phaser. There might be relevant details there:

https://phaser.discourse.group/t/animations-got-slower/8197/23

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

3 participants