REAL TIME CLOCK

[Updated for QLab 4.1 13 JUL 2017]

This example workspace renders a real-time clock, that can either use the system time, to show the actual time, or you can enter a start time and it will run from there.

How It Works:

Real Time Clock

The Script reads the system time and calculates the angular rotation required to set the hands to the correct time.  The geometry the AppleScript video cue hooks use, (quaternions),  is really brain damaging, so it’s much easier to put the calculated angles into z rotations of  some fade cues (called H, M, and S) and move the hands from their original  to the required positions, by firing these fades.

set hourstring to hours of (current date)
if hourstring > 11 then
set hourstring to hourstring – 12
end if
set minutestring to minutes of (current date)
set secondstring to (seconds of (current date)) + 1
tell application id “com.figure53.qlab.3” to tell front workspace
set rotation type of cue “H” to 3
set rotation of cue “H” to -((hourstring * 30) + (minutestring * 0.5))
set rotation type of cue “M” to 3
set rotation of cue “M” to -((minutestring * 6) + (secondstring * 0.1))
set rotation type of cue “S” to 3
set rotation of cue “S” to -(secondstring * 6)
end tell

In Cue 2 the hands are set to the time in the script rather than the system time.

set hourstring to 15
set minutestring to 33
set secondstring to 45
–Do Not edit anything below this line
set secondstring to secondstring + 1
if hourstring > 11 then
set hourstring to hourstring – 12
end if
tell application id “com.figure53.qlab.3” to tell front workspace
set rotation type of cue “H1” to 3
set rotation of cue “H1” to -((hourstring * 30) + (minutestring * 0.5))
set rotation type of cue “M1” to 3
set rotation of cue “M1” to -((minutestring * 6) + (secondstring * 0.1))
set rotation type of cue “S1” to 3
set rotation of cue “S1” to -(secondstring * 6)
end tell

The graphic elements of the hour and minute hands are pictures of the hands on a transparent background. The stepping second-hand is a 1 minute looping  1 fps video with alpha that is also rotated to give the correct start time.  The Hour and minute hands then rotate for 10 hours using fade cues, the hour hand rotating  300 degrees and the minute hand 3600 degrees. A looping audio cue provides the tick.

You can download the workspace here.

You can customize the appearance of the clock by editing the individual graphic elements in the video folder, in Photoshop or another graphics editor. In the first instance, it might be better to retain the size of the original elements. Make sure you retain the transparency when saving your new elements.

Chapter Author: Mic Pool

Chapter graphic and graphics for watch elements: Bell and Ross from Wiki Commons. Licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Modified image redistributed
under the same license.Creative Commons License
MenuGraphic