Skip to content

Instantly share code, notes, and snippets.

Fang Jin windmaomao

  • Raleigh, NC
View GitHub Profile
windmaomao / animationStrategy.js
Created May 23, 2020
In doing so, we guarantee that the animation time is independent of how often the timer callback is actually executed. If there are big delays (due to other blocking events), this method may result in dropped frames.
View animationStrategy.js
const animationRate = 30; // 30 ms
let initialTime, elapsedTime;
function animate(deltaT) {
// calculate object positions based on deltaT
function onFrame() {
const currentTime = new Date().getTime();
You can’t perform that action at this time.