Skip to content

Commit

Permalink
Add an FPS meter to playground-complete.html
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Jul 7, 2015
1 parent 69a58b4 commit 9fd6387
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
26 changes: 25 additions & 1 deletion examples/playground-complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
position: absolute;
left: 10px;
right: 10px;
top: 10px;
top: 20px;
bottom: 10px;
}
#stats {
position: absolute;
right: 0;
top: 0;
}
</style>
</head>

Expand All @@ -22,3 +27,22 @@
window.yourDiv = document.getElementById("yourDiv");
</script>
<script src="./playground.js"></script>

<!--
Measure the frame rate. Chrome devtools can do this, but having the devtools
open has a dramatic effect on frame rates.
-->
<script src="../node_modules/stats.js/build/stats.min.js"></script>
<script>
var stats = new Stats();
stats.setMode(0); // 0: fps, 1: ms
document.body.appendChild(stats.domElement);

var update = function() {
stats.end();
stats.begin();
requestAnimationFrame(update);
};
stats.begin();
requestAnimationFrame(update);
</script>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"sinon": "^1.12.2",
"sniper": "^0.2.16",
"source-map": "^0.3.0",
"stats.js": "^1.0.0",
"uglify-js": "^2.4.23",
"watchify": "^3.2.1"
},
Expand Down

0 comments on commit 9fd6387

Please sign in to comment.