Skip to content

Commit

Permalink
stats.js: r10 and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed May 9, 2012
1 parent b8bc6dd commit c96de43
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stats.js/build/Stats.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions stats.js/examples/basic.html
@@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<title>stats.js - basic example</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.js"></script>
<script>

var stats = new Stats();
stats.setMode( 1 );
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 );

</script>
</body>
</html>
125 changes: 125 additions & 0 deletions stats.js/examples/theming.html
@@ -0,0 +1,125 @@
<!doctype html>
<html>
<head>
<title>stats.js - theming example</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;
}

/*
* theme by: daformat / http://mathieujouhet.com/
*/

#stats #fps {
padding: 1px !important;
box-shadow: 1px 1px 3px rgba(0,0,0,.95) inset, 0px 0px 0px rgba(0,0,0,.75), 1px 1px 0px rgba(255,255,255,.25);
}

#stats #fps #fpsText {
left: 1px;
color: #80ccff !important;
background-image: -o-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
padding: 0 1px;
}

#stats #fps #fpsGraph {
left: 1px;
padding: 1px;
margin-bottom:1px;
background-color: rgba(0,155,255,0.5) !important;
background-image: -o-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
}

#stats #fps #fpsGraph span {
border-bottom: 1px solid !important;
border-color: rgba(0,155,255,0.9) !important;
background-color: rgba(0,0,20,0.8) !important;
}

#stats #ms {
padding: 1px !important;
box-shadow: 1px 1px 3px rgba(0,0,0,.95) inset, 0px 0px 0px rgba(0,0,0,.75), 1px 1px 0px rgba(255,255,255,.25);
}

#stats #ms #msText {
left: 1px;
color: #80ff80 !important;
background-image: -o-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
padding: 0 1px;
}

#stats #ms #msGraph {
left: 1px;
padding: 1px;
margin-bottom:1px;
background-color: rgba(0,255,0,0.5) !important;
background-image: -o-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
background-image: linear-gradient(top, rgba(255,255,255,.4) 0%, rgba(0,0,0,.35) 100%);
}

#stats #ms #msGraph span {
border-bottom: 1px solid !important;
border-color: rgba(0,255,0,0.9) !important;
background-color: rgba(0,20,0,0.8) !important;
}

</style>
</head>
<body>
<script src="../build/Stats.js"></script>
<script>

var stats = new Stats();
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 );

</script>
</body>
</html>

0 comments on commit c96de43

Please sign in to comment.