6.2. Timer — Manages the virtual time
The Timer class manages the virtual time and drives the entire
animation/simulation. Everything that is animated either directly or indirectly
connects to the time slot of the global Timer instance. This global
timer is automatically created by the scene and can be obtained by calling the
timer() method of the Scene class.
-
class Timer(name = ''Timer'', auto_insert = True)
- name is the component name.
-
Timer.time
- Current virtual time in seconds (DoubleSlot). This value is increased by
timestep whenever the step() method is called.
-
Timer.timestep
- The delta time step in seconds that represents one frame.
-
Timer.duration
- The total duration in seconds of the animation/simulation.
-
Timer.frame
- Current (fractional) frame number (as float).
-
Timer.fps
- Current frame rate (as float).
-
Timer.framecount
- Total number of frames of the animation/simulation (as float).
-
Timer.clock
- This value contains the value in seconds of the real clock.
-
Timer.startClock()
- Start the real clock.
-
Timer.stopClock()
- Stop the real clock.
-
Timer.step()
- Step to the next frame. This call increases the current virtual time by
timestep and emits a STEP_FRAME event.