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:
-
elementDOMEelementDestination DOM element
-
widthIntDesired width of new canvas element
-
heightIntDesired height of new canvas element
Returns:
drawDot
-
ctx -
centerPos -
radius -
color
Parameters:
-
ctxCanvasContextValid Canvas Context handle
-
centerPosXyPositionJsonJSON with two properties: x & y ints, position in pixels, format {x:
, y: } -
radiusIntDot's Radius
-
colorStringHex color
Returns:
drawText
-
ctx -
pos -
text -
font -
color -
align
Parameters:
-
ctxCanvasContextValid Canvas Context handle
-
posXYPosObjectJSON with two properties: x & y ints, position in pixels, format {x:
, y: } -
textStringAny string to be places at Pos
-
fontStringFont, CSS-like definition of size and font-family, i.e.
-
colorStringHexadecimal RGB color definition
-
alignString(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
