Members
center :point
Canvas center.
Type:
- point
clockRadius :number
Canvas radius.
Type:
- number
context :HTMLElement
Canvas context.
Type:
- HTMLElement
(constant) hostname :string
Server hostname.
0.0.0.0 means all IPv4 addresses on the local machine.
0.0.0.0 means all IPv4 addresses on the local machine.
Type:
- string
imgh :number
Image height.
Type:
- number
imgw :number
Image width.
Type:
- number
(constant) port :number
Server port.
Type:
- number
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. |
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. |
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. |
Returns:
a new scaled vector.
- Type
- point
setTime()
Redraw the clock: a logo, circle, three handles, ticks.
translate(pos, vec) → {point}
Translate a point.
Parameters:
Name | Type | Description |
---|---|---|
pos |
point | given point. |
vec |
Array.<number> | translation vector. |
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. |