标签:tick fun txt phi cti raw date() tag time()
需要看fps就用下面这段代码即可
var FPS = {};
FPS.time = 0;
FPS.FPS = 0;
FPS.startFPS = function (stage){
FPS.shape = new createjs.Shape();
FPS.shape.graphics.beginFill("#000000").drawRect(0, 0, 100, 20);
stage.addChild(FPS.shape);
FPS.txt =new createjs.Text("", "15px Arial", "#ffffff");
stage.addChild(FPS.txt);
createjs.Ticker.addEventListener("tick", FPS.TickerFPS);
}
FPS.TickerFPS = function (event)
{
FPS.date = new Date();
FPS.currentTime = FPS.date.getTime();
if(FPS.time!=0)
{
FPS.FPS = Math.ceil(1000/(FPS.currentTime - FPS.time));
}
FPS.time = FPS.currentTime;
FPS.txt.text = "FPS: "+FPS.FPS;
}
FPS.startFPS(stage);
标签:tick fun txt phi cti raw date() tag time()
原文地址:https://www.cnblogs.com/heteng/p/12207928.html