Clock

widgets. Clock

Class to manage the drawing and animation of a clock's face and hands.

Constructor

new Clock(face_canvas, hand_canvas, x_pos, y_pos, radius, text)

Source:
Properties:
Name Type Description
angle number

The angle from noon to draw the clock hand. Determined by the ClockUtil class.

filler boolean

Whether the clock is off. Filler clocks are not visible and hold space for possible word predictions in later rounds.

highlighted boolean

Whether the clock is highlighted in blue. The BroderClocks' class assigns this value to clocks with a high cscore`.

winner boolean

Whether the clock was recently selected and should be highlighted in green for the duration of the pause.

Parameters:
Name Type Description
face_canvas KeyboardCanvas

The KeyboardCanvas instance used to draw the clock faces.

hand_canvas KeyboardCanvas

The KeyboardCanvas instance used to draw the clock hands.

x_pos number

The starting x position in pixels of the clock, calculated in the ClockGrid class.

y_pos number

The starting x position in pixels of the clock, calculated in the ClockGrid class.

radius number

The radius of the clock in pixels, calculated in the ClockGrid class.

text string

The textual component of the clock's option.

Methods

draw_face()

Description:
  • Draws the clock face on the face_canvas without updating the minute hand.

Source:

draw_hand(clear)

Description:
  • Draws the clock minute hand on the clock_hand canvas.

Source:
Parameters:
Name Type Default Description
clear boolean true

Whether to clear the canvas of the previously drawn minute hand.