全部文本 #2431991 原始 编辑

Someone

公开 未列出 text v1 · 不可变
#2431991 ·已发布 2013-08-14 22:47 UTC
渲染后的文本正文
<!DOCTYPE html>

<html><head>

<title>FPS Counter</title>

<script type="text/javascript">
var setupFps = function(){

var lastTime = new Date();
var hits = 0;
var fps = Waiting;
var hit = function(){
hits++;
var nowTime = new Date();
if (nowTime.getTime()  lastTime.getTime() > 1000){
var dt = nowTime.getTime()  lastTime.getTime();
fps =  + Math.round(hits * 1000 / dt);
hits = 0;
lastTime = nowTime;
}
return fps;
};
return hit;
};

var hit = setupFps();

var render = function(){

ctx.fillStyle = #333333;
ctx.beginPath();
ctx.rect(0, 0, width, height);
ctx.closePath();
ctx.fill();
ctx.fillStyle = #ffffff;
ctx.fillText(hit(), 30, 30);
};
</script>

</head>

<body onload="function()">

<canvas id="hit">
</canvas>


</body>
</html>