{"action":"created","issue":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/2178","repository_url":"https://api.github.com/repos/photonstorm/phaser","labels_url":"https://api.github.com/repos/photonstorm/phaser/issues/2178/labels{/name}","comments_url":"https://api.github.com/repos/photonstorm/phaser/issues/2178/comments","events_url":"https://api.github.com/repos/photonstorm/phaser/issues/2178/events","html_url":"https://github.com/photonstorm/phaser/issues/2178","id":114094903,"number":2178,"title":"TweenManager.frameBased not working as expected","user":{"login":"mariogarranz","id":2812529,"avatar_url":"https://avatars.githubusercontent.com/u/2812529?v=3","gravatar_id":"","url":"https://api.github.com/users/mariogarranz","html_url":"https://github.com/mariogarranz","followers_url":"https://api.github.com/users/mariogarranz/followers","following_url":"https://api.github.com/users/mariogarranz/following{/other_user}","gists_url":"https://api.github.com/users/mariogarranz/gists{/gist_id}","starred_url":"https://api.github.com/users/mariogarranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariogarranz/subscriptions","organizations_url":"https://api.github.com/users/mariogarranz/orgs","repos_url":"https://api.github.com/users/mariogarranz/repos","events_url":"https://api.github.com/users/mariogarranz/events{/privacy}","received_events_url":"https://api.github.com/users/mariogarranz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-29T16:46:38Z","updated_at":"2016-04-19T22:47:45Z","closed_at":null,"body":"According to the docs, the frameBased property works like this:\r\n\r\n\r\n>_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._\r\n \r\n>_**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_\r\n\r\n\r\n\r\nHowever, 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.\r\n\r\nThere are a couple of threads on the forms about it:\r\n\r\nhttp://www.html5gamedevs.com/topic/18183-tweenmanagerframebased-not-working-as-expected/\r\nhttp://www.html5gamedevs.com/topic/18242-tweens-duration-different-on-different-machines/"},"comment":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/comments/212158634","html_url":"https://github.com/photonstorm/phaser/issues/2178#issuecomment-212158634","issue_url":"https://api.github.com/repos/photonstorm/phaser/issues/2178","id":212158634,"user":{"login":"steven-bowdridge","id":1387605,"avatar_url":"https://avatars.githubusercontent.com/u/1387605?v=3","gravatar_id":"","url":"https://api.github.com/users/steven-bowdridge","html_url":"https://github.com/steven-bowdridge","followers_url":"https://api.github.com/users/steven-bowdridge/followers","following_url":"https://api.github.com/users/steven-bowdridge/following{/other_user}","gists_url":"https://api.github.com/users/steven-bowdridge/gists{/gist_id}","starred_url":"https://api.github.com/users/steven-bowdridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steven-bowdridge/subscriptions","organizations_url":"https://api.github.com/users/steven-bowdridge/orgs","repos_url":"https://api.github.com/users/steven-bowdridge/repos","events_url":"https://api.github.com/users/steven-bowdridge/events{/privacy}","received_events_url":"https://api.github.com/users/steven-bowdridge/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T22:47:45Z","updated_at":"2016-04-19T22:47:45Z","body":"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.\r\n\r\nThis can be demonstrated with the Phaser 'Slow Down Time' example: http://phaser.io/examples/v2/time/slow-down-time\r\nOn 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.\r\n\r\nDebugging the issue it appears `this.game.time.elapsedMS` used in `TweenData#update` with time based updating is providing erroneous values that ignore frame rate:\r\nhttps://github.com/photonstorm/phaser/blob/v2.4.6/src/tween/TweenData.js#L363\r\n\r\nI suggest setting `game.tweens.frameBased = true`. The default behaviour produces erroneous tweens."}}