diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 08:53:44 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 08:53:44 -0500 |
commit | ed4a76a8fe639d00689dceddfe755a22cdcfa597 (patch) | |
tree | 51b3f7baa631df0d90179469dfd7a9be23983d97 /public/gl | |
parent | cube (diff) | |
download | webgl-ed4a76a8fe639d00689dceddfe755a22cdcfa597.tar.gz webgl-ed4a76a8fe639d00689dceddfe755a22cdcfa597.tar.bz2 webgl-ed4a76a8fe639d00689dceddfe755a22cdcfa597.zip |
movement
Diffstat (limited to 'public/gl')
-rw-r--r-- | public/gl/gl.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/public/gl/gl.js b/public/gl/gl.js index 20b6225..ca0dbe6 100644 --- a/public/gl/gl.js +++ b/public/gl/gl.js @@ -10,9 +10,15 @@ export { Mat4 } from './math/Mat4.js' export { Vec2 } from './math/Vec2.js' export { Vec3 } from './math/Vec3.js' export { Loop } +export { DT } +var DT = 0; +var last = Date.now() const Loop = (fn) => { const callback = () => { + var now = Date.now() + DT = ( now - last) / 1000 + last = now fn() window.requestAnimationFrame(callback) } |