ukeGeeks.canvasTools Class
Wraps three common canvas actions: adding canvas element to DOM, drawing a dot, adding text.
Methods
addCanvas
-
element
-
width
-
height
Create new canvas DOM element and add it to element. Return convas context handle. Reutns null if there's a problem.
Parameters:
-
element
DOMEelementDestination DOM element
-
width
IntDesired width of new canvas element
-
height
IntDesired height of new canvas element
Returns:
drawDot
-
ctx
-
centerPos
-
radius
-
color
Parameters:
-
ctx
CanvasContextValid Canvas Context handle
-
centerPos
XyPositionJsonJSON with two properties: x & y ints, position in pixels, format {x:
, y: } -
radius
IntDot's Radius
-
color
StringHex color
Returns:
drawText
-
ctx
-
pos
-
text
-
font
-
color
-
align
Parameters:
-
ctx
CanvasContextValid Canvas Context handle
-
pos
XYPosObjectJSON with two properties: x & y ints, position in pixels, format {x:
, y: } -
text
StringAny string to be places at Pos
-
font
StringFont, CSS-like definition of size and font-family, i.e.
-
color
StringHexadecimal RGB color definition
-
align
String(optional) Text will be aligned at position (pos) as [left,right,center]. Default is center.
Returns:
Properties
_public
JsonObject
attach public members to this object