diff options
| author | s1n <[email protected]> | 2019-09-26 16:38:41 -0700 |
|---|---|---|
| committer | s1n <[email protected]> | 2019-09-26 16:38:41 -0700 |
| commit | b434497d850202566eea46450775c2f2a3f82c32 (patch) | |
| tree | 91f320b88cf491c8d62e9b3594513895a8a00c5c /js/performance-stats.js | |
| parent | fix redirect to mobile (diff) | |
| download | s1n.pw-admin-b434497d850202566eea46450775c2f2a3f82c32.tar.xz s1n.pw-admin-b434497d850202566eea46450775c2f2a3f82c32.zip | |
add performance stats
Diffstat (limited to 'js/performance-stats.js')
| -rw-r--r-- | js/performance-stats.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/performance-stats.js b/js/performance-stats.js new file mode 100644 index 0000000..1015308 --- /dev/null +++ b/js/performance-stats.js @@ -0,0 +1,24 @@ +var stats = new Stats(); +stats.setMode(0); +document.body.appendChild(stats.domElement); + +var canvas = document.createElement('canvas'); +canvas.width = 512; +canvas.height = 512; +document.body.appendChild(canvas); + +var context = canvas.getContext('2d'); +context.fillStyle = 'rgba(127,0,255,0.05)'; +setInterval(function () { + var time = Date.now() * 0.001; + context.clearRect(0, 0, 512, 512); + stats.begin(); + for (var i = 0; i < 2000; i++) { + var x = Math.cos(time + i * 0.01) * 196 + 256; + var y = Math.sin(time + i * 0.01234) * 196 + 256; + context.beginPath(); + context.arc(x, y, 10, 0, Math.PI * 2, true); + context.fill(); + } + stats.end(); +}, 1000 / 60);
\ No newline at end of file |