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

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
月光博客
月光博客
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
U
Unit 42
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
V
Visual Studio Blog
腾讯CDC
IT之家
IT之家

博客园 - 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();

        }

      }

}