1.0.6 • Published 7 years ago

canvas_render v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

Members

Functions

add

This function adds objects to the stage

Kind: global variable

destroy

This function destroy an object from the stage

Kind: global variable

ParamTypeDescription
namestringThis is the name of the object

line(start, end, style, stroke)

Takes a vector as start point and another vector as end point of the line

Kind: global function

ParamTypeDescription
startarrayThis will be the start point of the line
endarrayThis will be the end point of the line
styleobjectThis will be the style of the line
strokebooleanIf true the line will have an stroke

poligon(vecs, color, stroke)

This function draws a poligon in the screen

Kind: global function

ParamTypeDescription
vecsarrayThis contains all the points of the figure
colorstringThis is the color of the poligon
strokebooleanIf this true the poligon will have borders

rect(position, width, height, color)

This function draws a rect in the screen

Kind: global function

ParamTypeDescription
positionarrayThis array contains the coordinates of the rect
widthnumberThis is the width of the rect
heightnumberThis is the height of the rect
colorstringThis will be the color of the rect

strokeRect(position, width, height, color, lineWidth)

This function draws the borders of a a rect in the screen

Kind: global function

ParamTypeDescription
positionarrayThis array contains the coordinates of the rect
widthnumberThis is the width of the rect
heightnumberThis is the height of the rect
colorstringThis will be the color of the rect
lineWidthnumberThis is the width of the line

text(texto, position, style, stroke)

This function draws a text in the screen

Kind: global function

ParamTypeDescription
textostringThis is the text that will be drawn
positionarrayThis array contains the coordinates of the text
styleobjectThis object contais the styles of the text
strokebooleanIf true the text will have borders

strokeCircle(position, radius, color, width)

Draws the borders of a circle in the screen

Kind: global function

ParamTypeDescription
positionarrayThis array contains the X and Y coordinates
radiusnumberThis will be the radius of the circle
colorstringThis will be the color of the circle
widthnumberThis is the width of the line

circle(position, radius, color)

Draws a circle in the screen

Kind: global function

ParamTypeDescription
positionarrayThis array contains the X and Y coordinates
radiusnumberThis will be the radius of the circle
colorstringThis will be the color of the circle

strokeArc(position, radius, lineWidth, eAngl, aAngl, color)

This function draws the borders of an arc in the screen

Kind: global function

ParamTypeDescription
positionarrayThis array contains the X and Y coordinates
radiusnumberThis is the radius of the arc
lineWidthnumberThis is the width of the line
eAnglnumberThis is the end angle
aAnglnumberThis is the start angle
colorstringThis is the color of the arc

loadImage(name, src)

This function loads an image and saves it.

Kind: global function

ParamTypeDescription
namestringWith this name the loaded image will be save in a image cache for later use
srcstringThis is where the image is save

drawImage(name, position, anchor, rotation, width, height)

This function draws an image on the screen

Kind: global function

ParamTypeDescription
namestringThis is the name of the image saved in the imageCache
positionobjectThis object contains the position of the image
anchorobjectThis will be the point of rotation of the image
rotationnumberThis will be the rotation of the image
widthnumberThis will be the width of the image
heightnumberThis will be the height of the image

SpriteSheet(name, config)

This function renders an animation from an srpite sheet in the screen

Kind: global function

ParamTypeDescription
namestringThis will be the name of the animation
configobjectThis object contains the configuration of the animation

Sprite(name, position, scale, rotation, anchor, src)

This function creates an image object

Kind: global function

ParamTypeDescription
namestringThis will be the name of the image
positionobjectThis object contains the position of the image
scaleobjectThis object contains the scale of the image
rotationnumberThis is the rotation of the image
anchorobjectThis will be the point of rotation of the image
srcstringThis will be the location where the image is saved

Point(x, y)

This function creates an Point object

Kind: global function

ParamTypeDescription
xnumberThe X coordinate
ynumberThe Y coordinate

init(canvasName, width, height)

This function initializes the canvas

Kind: global function

ParamTypeDescription
canvasNamestringIf this parameter is given the render will try to find a canvas with this ID to draw in
widthnumberThis will be the width of the canvas
heightnumberThis will be the height of the canvas

setScale(scale)

This function sets the scale of the canvas to the parameter given

Kind: global function

ParamTypeDescription
scalenumberThis will be the scale of the canvas

setStyle(style)

This function puts all the styles given in the context

Kind: global function

ParamTypeDescription
styleobjectThis object contains the styles

setCenter(vec)

This function translates the context to the coordinates given

Kind: global function

ParamTypeDescription
vecarrayThis is an array of coordinates

clear(color)

Clears the entire screen

Kind: global function

ParamTypeDefaultDescription
colorstring"#000"With this color the canvas will be clear

smoth(state)

Enables and disbales canvas smoth

Kind: global function

ParamTypeDescription
statebooleanIf true enables canvas smoth and if false disbales canvas smoth

Stage()

This object contains all that will be render

Kind: global function

update()

This function renders all the objects of the stage

Kind: global function

Graphic(renderFunction, configuration)

This class creates an object that draws in the screen

Kind: global function

ParamTypeDescription
renderFunctionfunctionThis function draws in the screen
configurationobjectThis object contais information as the position of where things will be drawn the rotation etc..
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago