new Scene(wrapper)
todoc
Parameters:
Name | Type | Description |
---|---|---|
wrapper |
HTMLElement |
Properties:
Name | Type | Description |
---|---|---|
wrapper |
HTMLElement | |
screen |
Screen | |
cursor |
Cursor | |
settings |
PublicStorage | |
loader |
Loader | |
queue |
Queue |
Extends
Members
(readonly) lastTick :int
The last tick of the scene
(readonly) readyState :String
The loading state of the scene
(readonly) run :Boolean
The running status of the scene
(readonly) tickCount :int
The number of ticks
(readonly) uuid :String
The uuid of the scene
Methods
addEventListener(type, listener) → {EventTarget}
Adds a listener to the specified event
Parameters:
Name | Type | Description |
---|---|---|
type |
String | |
listener |
function |
- Inherited From:
- Source:
Returns:
EventTargetthis
addLayer(layer, orderIDopt) → {Scene}
Adds a Layer to the Scene
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
layer |
Layer | ||
orderID |
int |
<optional> |
Returns:
Scenethis
addPlugin(pluginID, pluginConfigopt) → {Scene}
Adds a plugin to the scene
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pluginID |
String | ||
pluginConfig |
Object |
<optional> |
Returns:
Scenethis
addTask(listener, delayopt, thisArgopt) → {Task}
Adds a task to the queue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
listener |
function | ||
delay |
int |
<optional> |
|
thisArg |
Object |
<optional> |
Returns:
TaskcheckCollisions() → {Scene}
Calls each CollisionDetector check method from the watchList
Returns:
Scenethis
createAbstractElement(elemID, elementType, elementUseopt, argsopt) → {Scene}
Creates an AbstractElement
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elemID |
String | ||
elementType |
String | ||
elementUse |
Object |
<optional> |
|
args |
Array |
<optional> |
Returns:
Scenethis
createClass(className, classData) → {Scene}
Creates a new class
Parameters:
Name | Type | Description |
---|---|---|
className |
String | |
classData |
Object |
Returns:
Scenethis
createLayer(layerUseopt) → {Layer}
Creates a new Layer and returns it
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
layerUse |
Object |
<optional> |
Returns:
LayerdispatchEvent(type) → {EventTarget}
Dispatches an Event at the specified EventTarget
Parameters:
Name | Type | Description |
---|---|---|
type |
String |
- Inherited From:
- Source:
Returns:
EventTargetthis
eachElement(callback) → {Scene}
Executes a provided callback function recursively once per Element in ascending order
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
Returns:
Scenethis
eachEventListener(type, callback) → {EventTarget}
Executes a provided function once per event listener
Parameters:
Name | Type | Description |
---|---|---|
type |
String | |
callback |
function |
- Inherited From:
- Source:
Returns:
EventTargetthis
eachLayer(callback) → {Scene}
Executes a provided callback function once per Layer in ascending order
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
Returns:
Scenethis
emit(type) → {EventTarget}
Dispatches an Event at the specified EventTarget
Parameters:
Name | Type | Description |
---|---|---|
type |
String |
- Inherited From:
- Source:
- See:
Returns:
EventTargetthis
getDraggedElements() → {Array}
Returns an Array of currently dragged Elements
Returns:
ArraygetFocusedElements() → {Array}
Returns an Array of currently hovered Elements
Returns:
ArraygetLayer(layerId) → (nullable) {Layer}
Gets a Layer by id
Parameters:
Name | Type | Description |
---|---|---|
layerId |
String |
Returns:
LayerhasEventListener(type) → {Boolean}
Determines if the eventTarget has eventListeners of the given type
Parameters:
Name | Type | Description |
---|---|---|
type |
String |
- Inherited From:
- Source:
Returns:
Booleaninclude(data, callback) → {Scene}
Includes external data
Parameters:
Name | Type | Description |
---|---|---|
data |
String | Object | |
callback |
function |
Returns:
Scenethis
insertLayer(layerUseopt, orderIDopt) → {Layer}
Combination of Scene#createLayer and Scene#addLayer
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
layerUse |
Object |
<optional> |
|
orderID |
int |
<optional> |
Returns:
Layerlater(listener, delay, thisArgopt) → {Scene}
Adds a task to the queue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
listener |
function | ||
delay |
int | ||
thisArg |
Object |
<optional> |
Returns:
Scenethis
neglect(detector) → {Scene}
Removes the given CollisionDetector from the watchList
Parameters:
Name | Type | Description |
---|---|---|
detector |
CollisionDetector |
Returns:
Scenethis
off(type, listener) → {EventTarget}
Removes a listener from the specified event
Parameters:
Name | Type | Description |
---|---|---|
type |
String | |
listener |
function |
- Inherited From:
- Source:
- See:
Returns:
EventTargetthis
offAll() → {EventTarget}
Removes all listeners
- Inherited From:
- Source:
- See:
Returns:
EventTargetthis
on(type, listener) → {EventTarget}
Adds a listener to the specified event
Parameters:
Name | Type | Description |
---|---|---|
type |
String | |
listener |
function |
- Inherited From:
- Source:
- See:
Returns:
EventTargetthis
onScreen(element, partlyopt) → {Boolean}
Determines if a given element is on the screen
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
element |
Element | |||
partly |
Boolean |
<optional> |
true |
- Source:
- To Do:
-
- Consider parent layer offset on collision check
- Consider element rotation and scale on collision check
Returns:
BooleanplayAudio(audio, volumeopt, resetopt, callbackopt) → {Scene}
Plays an audio
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
audio |
Audio | String | ||
volume |
int |
<optional> |
|
reset |
Boolean |
<optional> |
|
callback |
function |
<optional> |
Returns:
Scenethis
preload(path, components) → {Scene}
Loads components
Parameters:
Name | Type | Description |
---|---|---|
path |
String | |
components |
Object |
Returns:
Scenethis
removeAllEventListeners() → {EventTarget}
Removes all listeners
- Inherited From:
- Source:
Returns:
EventTargetthis
removeEventListener(type, listener) → {EventTarget}
Removes a listener from the specified event
Parameters:
Name | Type | Description |
---|---|---|
type |
String | |
listener |
function |
- Inherited From:
- Source:
Returns:
EventTargetthis
removeLayer(layer) → {Scene}
Removes a Layer from the Scene
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer |
Returns:
Scenethis
removeTask(task) → {Scene}
Removes a task from the queue
Parameters:
Name | Type | Description |
---|---|---|
task |
Task |
Returns:
Scenethis
repeat(listener, times, delayopt, thisArgopt) → {Scene}
Adds a task to the queue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
listener |
function | ||
times |
int | ||
delay |
int |
<optional> |
|
thisArg |
Object |
<optional> |
Returns:
Scenethis
resize(width, height) → {Scene}
Sets the size of the scene
Parameters:
Name | Type | Description |
---|---|---|
width |
int | |
height |
int |
Returns:
Scenethis
setHeight(height) → {Scene}
Sets the height of the scene
Parameters:
Name | Type | Description |
---|---|---|
height |
int |
Returns:
Scenethis
setWidth(width) → {Scene}
Sets the width of the scene
Parameters:
Name | Type | Description |
---|---|---|
width |
int |
Returns:
Scenethis
toString() → {String}
Returns the string value of the scene
- Overrides:
- Source:
Returns:
StringupdateFocusedElements(e) → {Scene}
Updates the list of focused elements, emits the "mousemove", "mouseenter" and "mouseleave" events if necessary
Parameters:
Name | Type | Description |
---|---|---|
e |
MouseEvent |
- Source:
- To Do:
-
- Break forEach if the propagation is stopped
- Consider parent layer offset on collision check
- Consider element rotation and scale on collision check
Returns:
Scenethis
watch(element, targets, autoRemoveopt) → {CollisionDetector}
Creates a new CollisionDetector and adds it to the watchList
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
element |
Element | ||
targets |
* | ||
autoRemove |
Boolean |
<optional> |