new Scene(ctx, width, height)
The scene includes the actors and call their update and render methods.
Parameters:
Name | Type | Description |
---|---|---|
ctx | * | context of the canvas |
width | number | width of the canvas |
height | number | height of the canvas |
Methods
DOMOffset(el) → {object}
Get DOM offset from given element.
Parameters:
Name | Type | Description |
---|---|---|
el | Object | HTML DOM element |
Returns:
- x and y position
- Type:
- object
addActor(actor)
Add an actor to the scene.
Parameters:
Name | Type | Description |
---|---|---|
actor | Object |
getIdInScene(id)
Get object to id from scene.
Parameters:
Name | Type | Description |
---|---|---|
id | string |
getObjectsInScene(obj)
Get objects based on the obj constructor.
Parameters:
Name | Type | Description |
---|---|---|
obj | string |
purge()
Empty the scene with setting and empty list as actors.
removeActor(actor)
Remove an actor from the scene.
Parameters:
Name | Type | Description |
---|---|---|
actor | Object |
render(dt)
It renders first the binding and then the rest for a better visual effect.
Parameters:
Name | Type | Description |
---|---|---|
dt | number |
update(dt)
Iterates over the actors and call their update method.
Parameters:
Name | Type | Description |
---|---|---|
dt | number |