惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
F
Fortinet All Blogs
C
Check Point Blog
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - appleseed

搭建一个typescript下的webgl写代码环境。 Unity3d 小游戏从入门到??? Unity3d 小游戏详解 linux随笔 使用public/private key让putty(ssh)自动登录(以及linux上使用密钥做ssh自动登陆) texturetool 3d专业术语 Molehill [转] 使用Duff's Device算法优化for循环 转 [教程] [Lii]最小帧速下的强制渲染——自制图像引擎的同学看过来 - appleseed AI笔记 as3对象池研究 启动GPU加速的方法 恋爱秘籍 .... ..... AS3位运算
转 降频的时候处理方法
appleseed · 2011-02-14 · via 博客园 - appleseed

/**

 * EnterFrame事件处理

 */

private var frameRate:uint = stage.frameRate;

private var halfRate:uint = frameRate >> 1;

private var intervalTime:uint = 1000/frameRate;

private var deltaTime:Number = 0;

private var lastTime:uint = 0;

private function enterFrame(e:Event):void

{

     //计算实际帧频

    var nowTime:uint = getTimer();

      deltaTime = nowTime - lastTime;

      lastTime= nowTime;

      var realFrame:uint = uint(1000/deltaTime);//上一帧的实际帧频

    if(realFrame >= halfRate){

        gameLoop();

      }else{

        //flashplayer最小化后要做的事

        trace('浏览器最小化了');

        /** 补帧 */

        var tweenFrames:uint = frameRate/realFrame;

        for(var i:uint=0; i<tweenFrames; i++){

               gameLoop();

        }

      }

}