Fps="0" gives exactly 1 FPS on html5 target

Documentation states that

There is a special fps=“0” value for HTML5, which is default, which uses “requestAnimationFrame” instead of forcing a frame rate.

I’ve got these lines in my project.html file:

<window width="320" height="320" resizable="false" hardware="true" vsync="true" />
<window fps="60" unless="html5" /> 
<window fps="0" if="html5" /> 

I also tried to leave only fps=“0” in a single window tag but no matter what I’m trying I’m getting exactly 1 fps in the browser. Any other value (e.g. 60) works fine, but I don’t want to force fps on html5 target if it’s possible.

I’m using OpenFL 6.0.1

Lime is currently using requestAnimationFrame if frameRate >= 60

I’m open to ideas here, do you think the current behavior is sensible, and we should change the documentation, or should we leave the documentation and change the behavior of Lime?

This also applies to when you set the frame rate at runtime, such as stage.frameRate

Interestingly, it appears that Flash Player supports frameRate values between 0.01 to 1000, so we could consider having a lower frequency than 1 FPS on the low end

Oh, completely forgot that I left this topic here :sweat_smile:

In my opinion it would be nice just to have an option to set “the most suitable” frame rate if it is possible. Trigger redraw on requestAnimationFrame on html5 is a good example. On desktop targets I think it is a good practice to try to sync the frame rate with the monitor’s refresh rate.

By the way I just remembered that I had some problems with image tearing when “fps” was set to 60 but the problem disappeared when I set fps to 61 :thinking: