How to set FPS

I try to set the FPS in AppDelegate.js

director.setAnimationInterval(1.0 / 24);

Trying to save some cycles on mobile browsers by lowering the fps, but it always seems to be 60fps no matter how I set it.

I’m seeing the same behaviour as you are.

I did find this though:
Only supports animation intervals of 1/60 1/30 & 1/15
http://www.cocos2d-x.org/reference/html5-js/symbols/cc.DisplayLinkDirector.html

However even trying one of those values, I still get 60FPS.

Sorry, not much help from me.

because we run the mainloop is use window.requestAnimFrame, the FPS set by browser.

you can change the FPS like this:

  1. open platform/Application.js, found “run” function.
  2. delete such code:
    @ if (window.requestAnimFrame) {
    var callback = function () {
    cc.Director.getInstance().mainLoop();
    window.requestAnimFrame(callback);
    };
    cc.log(window.requestAnimFrame);
    window.requestAnimFrame(callback);
    }@

Yes! That works perfectly. Thanks

One note: it seems that any frame rate will work despite the note that Erik found. 1/24, 1/18 etc all seem to work!

Thanks for the help.

Mitch