Jump to content
Search Community

jermbo

Members
  • Posts

    15
  • Joined

  • Last visited

Community Answers

  1. jermbo's post in FPS Examples was marked as the answer   
    I noticed things didn't work on the phone, and I figured out that it's because the requestAnimationFrame. Here is an example that would work in a lot of different situations.  I see Chrome gives me a waring, telling me to use the standard 'requestAnimationFrame', but I can live with a warning.
    // FPS Tests var fps = document.getElementById('fps'), startTime = Date.now(), frame = 0, requestAnimationFrame = window.requestAnimationFrame ||                             window.webkitRequestAnimationFrame ||                             window.mozRequestAnimationFrame ||                             window.oRequestAnimationFrame ||                             window.msRequestAnimationFrame; function tick() { var time = Date.now(); frame++; if (time - startTime > 1000) { fps.innerHTML = Number(frame / ((time - startTime) / 1000)).toFixed(1) + ' fps'; startTime = time; frame = 0; } requestAnimationFrame(tick); } TweenLite.delayedCall( 1, tick );
×
×
  • Create New...