ClockUtil

clock_util. ClockUtil

This class is instantiated as the “backend” of the clocks defined in Widgets. This class is not for a single clock, but all clocks on the screen. It orchestrates the phases assigned to each clock and the process of updating their hands on each animation frame.

Constructor

new ClockUtil(parent, bc, clock_inf)

Source:
Properties:
Name Type Description
num_divs_time number

The number of unique hour hand phases (determined by rotation period and framerate).

spaced SpacedArray

The instance of the SpacedArray class.

hl HourLocs

The instance of the HourLocs class.

cur_hours Array.<number>

An array specifying the hour hand locations for each clock. This value corresponds to an index in the `SpacedArray'.

clock_angles Array.<number>

An array specifying the angle of the clock hand corresponding to each entry in cur_hours.

Parameters:
Name Type Description
parent Keyboard

The instance of the Keyboard class.

bc BroderClocks

The instance of the BroderClocks class.

clock_inf ClockInference

The instance of the ClockInference class.

Methods

change_period(new_period)

Description:
  • Recalculates the clock hours and spacedArray given the new rotation period.

Source:
Parameters:
Name Type Description
new_period number

The time in seconds of the new clock rotation period.

increment(clock_index_list)

Description:
  • Updates the cur hours by 1, and update both the screen and the parameters of the clocks.

Source:
Parameters:
Name Type Description
clock_index_list Array.<number>

Array containing the indices of all active clocks to increment.

update_curhours(update_clocks_list)

Description:
  • Updates cur hours by one for all clocks: increment the index among [0,80] by 1 for where the clock hand exists.

Source:
Parameters:
Name Type Description
update_clocks_list Array.<number>

Array containing the indices of all active clocks to increment.