Skip to content

Commit

Permalink
Add time getter
Browse files Browse the repository at this point in the history
  • Loading branch information
KoltesDigital committed May 4, 2019
1 parent 5c48f72 commit 1de41f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/veda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export default class Veda {
this.soundRenderer.setLength(length);
}

getTime(): number {
return (Date.now() - this.start) / 1000;
}

resetTime(): void {
this.start = Date.now();
this.uniforms.time.value = 0;
Expand Down Expand Up @@ -653,7 +657,7 @@ export default class Veda {
// update start so that time dosn't change after stopRecording
this.start = Date.now() - relTime * 1000;
} else {
this.uniforms.time.value = (Date.now() - this.start) / 1000;
this.uniforms.time.value = this.getTime();
}

this.targets = [this.targets[1], this.targets[0]];
Expand Down

0 comments on commit 1de41f9

Please sign in to comment.