Last active
August 29, 2015 13:55
-
-
Save toshinarin/8782930 to your computer and use it in GitHub Desktop.
ブラウザのFPSを表示するブックマークレット
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(){$(function(){var requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var prev=0;var info=$('<div id="testest"></div>').css({position:"fixed",left:10,bottom:20,backgroundColor:"rgba(0, 0, 0, 0.8)",fontSize:12,color:"#ffffff",padding:5,zIndex:1e5}).appendTo("body");var count=0;function step(timestamp){if(++count==30){info.text((1e3/((timestamp-prev)/count)+"").substr(0,5));prev=timestamp;count=0}requestAnimationFrame(step)}requestAnimationFrame(step)})}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
動作させるには、jQueryが必要です。