OP FPS Counter

Simple rainbow FPS counter :D

  1. // ==UserScript==
  2. // @name OP FPS Counter
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Simple rainbow FPS counter :D
  6. // @author You
  7. // @match *://*/*
  8. // @license MIT
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var fps = 0;
  16. var el = top.document.createElement('div')
  17. el.style = "position:fixed;top:0%;left:1%;color:gray;font-family:Arial;font-size:23px;z-index:999999999999999999999;";
  18. el.innerHTML = "60";
  19. top.document.body.appendChild(el)
  20. var i = 0;
  21. setInterval(()=>{
  22. el.innerHTML = fps+" FPS";
  23. fps=0;
  24. },1000);
  25. setInterval(()=>{
  26. el.style.color = "hsl(" + (360 * i / 100) + ",80%,50%)";
  27. if(i==100){i=0};
  28. i+=1;
  29. },10);
  30. function counter() {
  31. window.requestAnimationFrame(counter);
  32. fps += 1;
  33. }
  34. counter();
  35. })();
  36.  
  37.  
  38.  
  39.