Real-time Clock

This example workspace renders a real-time clock which can either use the system time, to show the actual time, or a start time which you select.

How It Works

Real-time Clock

The Script cue reads the system time and calculates the angular rotation required to set the hands to the correct time. Rather than use AppleScript to directly move the images, which requires some very heady, graduate-level quaternion mathematics, we’ll instead put the calculated angles into single-axis Z rotations of some Fade cues (called H, M, and S) and move the hands by triggering these cues.

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 looping Video cue, one minute long, rendered at 1 frame per second with an alpha channel. This Video cue is also rotated to give the correct start time. The hour and minute hands then rotate for ten 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 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.

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