Global

Members

center :point

Canvas center.
Type:
  • point
Source:

clockRadius :number

Canvas radius.
Type:
  • number
Source:

context :HTMLElement

Canvas context.
Type:
  • HTMLElement
Source:

(constant) hostname :string

Server hostname.
0.0.0.0 means all IPv4 addresses on the local machine.
Type:
  • string
Source:

imgh :number

Image height.
Type:
  • number
Source:

imgw :number

Image width.
Type:
  • number
Source:

(constant) port :number

Server port.
Type:
  • number
Source:

Methods

_imgSize(w, w, r) → {Array.<number>}

Set the image dimension.
Parameters:
Name Type Description
w number image width.
w number image height.
r number clock radius.
Source:
Returns:
scale to fit the image in the clock without distortion.
Type
Array.<number>

circle(center, radius, fill)

Draw a circle.
Parameters:
Name Type Default Description
center point of the circle.
radius number of the circle.
fill boolean true draws a solid or hollow circle.
Source:
See:

polar2Cartesian(radius, angle) → {point}

Convert from polar to cartesian coordinates.
Parameters:
Name Type Description
radius number vector length.
angle number vector angle.
Source:
Returns:
a 2D point.
Type
point

scale(pos, vec) → {point}

Scale a vector.
Parameters:
Name Type Description
pos point given vector (pos-[0,0]).
vec Array.<number> scale factor.
Source:
Returns:
a new scaled vector.
Type
point

setTime()

Redraw the clock: a logo, circle, three handles, ticks.
Source:

translate(pos, vec) → {point}

Translate a point.
Parameters:
Name Type Description
pos point given point.
vec Array.<number> translation vector.
Source:
Returns:
a new translated point.
Type
point

Type Definitions

point.

A 2D point.
Type:
  • Object
Properties:
Name Type Description
x number coordinate.
y number coordinate.
Source: