summaryrefslogtreecommitdiff
path: root/js/performance-stats.js
diff options
context:
space:
mode:
authors1n <[email protected]>2020-03-28 10:31:08 -0700
committers1n <[email protected]>2020-03-28 10:31:08 -0700
commit6b81836e6b9815a2996a55ad37dcaa4d89f99e42 (patch)
tree74bb9aa78ca31a6acfffd908e34dfb0df433c707 /js/performance-stats.js
parentCreate .gitignore (diff)
downloadcyne.cf-backup-master.tar.xz
cyne.cf-backup-master.zip
3/28/2020, 10:30HEADmaster
Diffstat (limited to 'js/performance-stats.js')
-rw-r--r--js/performance-stats.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/performance-stats.js b/js/performance-stats.js
new file mode 100644
index 0000000..f9762d8
--- /dev/null
+++ b/js/performance-stats.js
@@ -0,0 +1,26 @@
+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();
+ // DO NOT ENABLE THIS LMAO
+ // document.write("Text to display.");
+ }
+ stats.end();
+}, 1000 / 60); \ No newline at end of file