TimerNode.js 311 B

12345678910111213141516171819202122232425
  1. import FloatNode from '../inputs/FloatNode.js';
  2. class TimerNode extends FloatNode {
  3. constructor() {
  4. super();
  5. this.time = performance.now();
  6. }
  7. update() {
  8. const time = performance.now();
  9. this.value += ( time - this.time ) / 1000;
  10. this.time = time;
  11. }
  12. }
  13. export default TimerNode;