Skip to content

Instantly share code, notes, and snippets.

@toshinarin
Last active August 29, 2015 13:55
Show Gist options
  • Save toshinarin/8782930 to your computer and use it in GitHub Desktop.
Save toshinarin/8782930 to your computer and use it in GitHub Desktop.
ブラウザのFPSを表示するブックマークレット
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)})}();
@toshinarin
Copy link
Author

動作させるには、jQueryが必要です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment