ClockActor
The built-in timer actor from @motionactor/primitives — elapsed time, stopwatch, pause and resume.
class Stopwatch extends LayoutActor<typeof stopwatchSlots> {
static slots = stopwatchSlots;
clock = child(ClockActor);
}ClockActor is how a scene gets elapsed time without reaching for Date.now(). Its
elapsed value is a function of the frame, so it survives seeking and parallel rendering.
Surface
- Derived elapsed reads in frames, seconds and milliseconds.
start(),pause(),resume()andreset().
this.clock.elapsedSeconds();
this.clock.elapsedFrames();
this.clock.start();
yield* this.runtime.wait(3);
this.clock.pause();Use it for
- Elapsed time displayed inside a scene — stopwatches, countdowns, session timers.
- Any time-driven display that must be correct after a seek.
Not a scheduler
ClockActor reports time; it does not run anything. Repeating work belongs in
runtime.loop, and delays belong in ctx.wait.