Getting fps from project.xml

Hi,
how do I get the “fps” parameter from the “window” tag in project.xml?
Thanks

If you would like to get the current frame rate at runtime, you can check stage.frameRate or stage.application.frameRate

In “project.xml” you can also use a variable if you need to reference the defined FPS value elsewhere

<log info="Window FPS: ${window.fps}" />
1 Like

Can I also change it at runtime?

Sure,

stage.frameRate = 40;

However, I would not recommend anything lower than 60 (which enables requestAnimationFrame) on HTML5, unless you do not need smooth animation

2 Likes

And how does requestAnimationFrame work exactly?

It synchronizes with the browser’s animation cycle, to redraw when the browser redraws. It results in much more fluid animation.

Ok, thank you, I didn’t know about this behavior below 60fps.