Skip to content

Instantly share code, notes, and snippets.

View windmaomao's full-sized avatar

Fang Jin windmaomao

  • Raleigh, NC
View GitHub Profile
import java.io.File
fun parseFile(name: String): List<String> =
File("../res/$name.input").readLines()
@windmaomao
windmaomao / animationStrategy.js
Created May 23, 2020 13:44
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.
const animationRate = 30; // 30 ms
let initialTime, elapsedTime;
function animate(deltaT) {
// calculate object positions based on deltaT
}
function onFrame() {
const currentTime = new Date().getTime();