new Canvas(canvas, camera)
Handles rendering entities onto the canvas element.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLElement | The active canvas element |
camera |
Camera | The camera instance |
Methods
-
clear(color)
-
Clears the entire canvas and optionally fills with a color
Parameters:
Name Type Argument Description color
String <optional>
If passed, will fill the canvas with the color value
-
getContext()
-
Returns the context object
Returns:
The 2D context object
- Type
- Object
-
render(entity)
-
Offsets canvas based on camera and calls an entity's render method passing the context.
Saves and restores context and beginning and end of operation.Parameters:
Name Type Description entity
Object [description]
-
setImageSmoothing(val)
-
Set the context image smoothing
Parameters:
Name Type Description val
Boolean The image smoothing value