Skip to content

Commit 3e5a35d

Browse files
committed
TimerEvent startAt field not scaled
A note regarding the feature `startAt` of `TimerEvent ` When an event gets added it should be either scaled by clock `timeScale` as well or not scaled at all - depending on the feature purpose. ```javascript // preUpdate loop event.elapsed = event.startAt * event.timeScale ``` In my understanding it should not be influenced by `timeScale` at all. As a developer I would use the feature of `startAt` to specify the exact offset for my event. In case I have looped `Timer` for one second and want to start the first loop in the middle, I would set the `startAt` to half a second. And scaling is applied during the timer run time as a factor of speed it elapses.
1 parent 7e23b8c commit 3e5a35d

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

src/time/Clock.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ var Clock = new Class({
101101
{
102102
event = this._pendingInsertion[i];
103103

104-
event.elapsed = event.startAt * event.timeScale;
105-
106104
this._active.push(event);
107105
}
108106

src/time/TimerEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var TimerEvent = new Class({
8181

8282
this.paused = GetFastValue(config, 'paused', false);
8383

84-
this.elapsed = 0;
84+
this.elapsed = this.startAt;
8585
this.hasDispatched = false;
8686
this.repeatCount = (this.repeat === -1 || this.loop) ? 999999999999 : this.repeat;
8787

0 commit comments

Comments
 (0)