Skip to content

Commit 46b6bb0

Browse files
authored
Update Timer.js
Add description.
1 parent c71a2d8 commit 46b6bb0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/jsm/misc/Timer.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* This class is a new alternative to THREE.Clock with a different API design and behavior.
3+
* The goal is to avoid the conceptual flaws that became apparent in THREE.Clock over time.
4+
*
5+
* - THREE.Timer has an update() method that updates its internal state. That makes it possible to call .getDeltaTime() and
6+
* .getElapsedTime() multiple times per simulation step without getting different values.
7+
* - The class uses the Page Visibility API to avoid large time delta values when the app is inactive (e.g. tab switched or browser hidden).
8+
* - It's possible to configure a fixed time delta and a time scale value (similar to Unity's Time interface).
9+
*/
110
class Timer {
211

312
constructor() {

0 commit comments

Comments
 (0)