Skip to content
Permalink
Browse files

Updated examples.

  • Loading branch information...
mrdoob committed Apr 11, 2016
1 parent 485c4fd commit 0b6cc6ed343ab72596a7a69c7e71ce74f763aa1e
Showing with 67 additions and 9 deletions.
  1. +9 −4 examples/basic.html
  2. +11 −5 examples/custom.html
  3. +47 −0 examples/stress.html
@@ -16,7 +16,7 @@
var stats = new Stats();
stats.showPanel( 1 );
document.body.appendChild( stats.domElement );
document.body.appendChild( stats.dom );
var canvas = document.createElement( 'canvas' );
canvas.width = 512;
@@ -25,9 +25,10 @@
var context = canvas.getContext( '2d' );
context.fillStyle = 'rgba(127,0,255,0.05)';
setInterval( function () {
var time = Date.now() * 0.001;
function animate() {
var time = performance.now() / 1000;
context.clearRect( 0, 0, 512, 512 );
@@ -46,7 +47,11 @@
stats.end();
}, 1000 / 60 );
requestAnimationFrame( animate );
}
animate();
</script>
</body>
@@ -18,8 +18,7 @@
var xPanel = stats.addPanel( new Stats.Panel( 'x', '#ff8', '#221' ) );
var yPanel = stats.addPanel( new Stats.Panel( 'y', '#f8f', '#212' ) );
stats.showPanel( 3 );
document.body.appendChild( stats.domElement );
document.body.appendChild( stats.dom );
var canvas = document.createElement( 'canvas' );
canvas.width = 512;
@@ -28,9 +27,12 @@
var context = canvas.getContext( '2d' );
context.fillStyle = 'rgba(127,0,255,0.05)';
setInterval( function () {
var time = Date.now() * 0.001;
var test = [];
function animate() {
var time = performance.now() / 1000;
context.clearRect( 0, 0, 512, 512 );
@@ -52,7 +54,11 @@
xPanel.update( x, 460 );
yPanel.update( y, 460 );
}, 1000 / 60 );
requestAnimationFrame( animate );
}
animate();
</script>
</body>
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>stats.js - stress test</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script src="../build/stats.min.js"></script>
<script>
var array = [];
for ( var i = 0; i < 500; i ++ ) {
var stats = new Stats();
stats.dom.style.position = 'relative';
stats.dom.style.float = 'left';
document.body.appendChild( stats.dom );
array.push( stats );
}
function animate() {
for ( var i = 0; i < array.length; i ++ ) {
var stats = array[ i ];
stats.update();
}
requestAnimationFrame( animate );
}
animate();
</script>
</body>
</html>

0 comments on commit 0b6cc6e

Please sign in to comment.
You can’t perform that action at this time.