Skip to content
forked from dacorvo/fpsmeter

A utility script to provide an average FPS value based on CSS transitions

Notifications You must be signed in to change notification settings

tigroo/fpsmeter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

#fpsmeter.js A script to evaluate the framerate of an animation embedded in a web page using CSS transitions.

Please refer to this blog post for an explaination of how it works: Effectively measuring browser framerate using CSS

##Usage

<script type='text/javascript' src='fpsmeter.js'></script>
...
<script type='text/javascript'>

if(!window.FPSMeter){
    alert("This test page doesn't seem to include FPSMeter: aborting"); 
    return;
}

var results = document.getElementById("results");

// Register a progress call-back
document.addEventListener('fps',
    function(evt) {
        results.innerHTML = "Current framerate: " + evt.fps + " fps";
    },
    false);

// Start FPS analysis, optionnally specifying the rate at which FPS 
// are evaluated (in seconds, defaults to 1).
FPSMeter.run();

// Do your stuff here
....

// Stop FPS analysis
FPSMeter.stop();

</script>

##Demo

Try out the demo.

##License

You may use this code under the terms of the MIT license.

About

A utility script to provide an average FPS value based on CSS transitions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published