@absulit/points
Version:
A Generative Art library made in WebGPU
48 lines (42 loc) • 1.07 kB
JavaScript
/**
* To manage time and delta time,
* based on https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js
* @class Clock
* @ignore
*/
class Clock {
constructor() {
}
/**
* Gets the current time, it does not calculate the time, it's calcualted
* when `getDelta()` is called.
*/
get time() {
return this.
}
/**
* Gets the last delta value, it does not calculate the delta, use `getDelta()`
*/
get delta() {
return this.
}
return (typeof performance === 'undefined' ? Date : performance).now();
}
/**
* Calculate time since last frame
* It also calculates `time`
*/
getDelta() {
this.
const newTime = this.
this.
this.
this.
return this.
}
}
export default Clock;