Classes
- _global_
- pulse
- pulse.Action
- pulse.AnimateAction
- pulse.Asset
- pulse.AssetBundle
- pulse.AssetManager
- pulse.BitmapChar
- pulse.BitmapFont
- pulse.BitmapLabel
- pulse.CanvasLabel
- pulse.Engine
- pulse.Event
- pulse.EventManager
- pulse.Layer
- pulse.MouseEvent
- pulse.MoveAction
- pulse.Node
- pulse.plugin
- pulse.plugin.Plugin
- pulse.plugin.PluginCallback
- pulse.plugin.PluginCollection
- pulse.Point
- pulse.Scene
- pulse.SceneManager
- pulse.Sound
- pulse.Sprite
- pulse.support
- pulse.TextFile
- pulse.Texture
- pulse.TouchEvent
- pulse.util
- pulse.Visual
Class pulse.Layer
Extends
pulse.Visual.
The layer object.
Defined in: /src\visual\layer.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
pulse.Layer(params)
Layers are the heart of the engine, as they are base canvas for drawingobjects.
|
| Field Attributes | Field Name and Description |
|---|---|
|
Associative array (object) of the nodes in this layer.
|
- Fields borrowed from class pulse.Visual:
- actions, alpha, alphaPrevious, anchor, anchorAngle, anchorPrevious, anchorRadius, bounds, boundsPrevious, canvas, events, invalidProperties, mousein, position, positionPrevious, positionTopLeft, positionTopLeftPrevious, rotation, rotationPrevious, runningActions, scale, scalePrevious, shadowBlur, shadowColor, shadowEnabled, shadowEnabledPrevious, shadowOffsetX, shadowOffsetY, shuffled, size, sizePrevious, updated, visible, visiblePrevious, zindex, zindexPrevious
- Fields borrowed from class pulse.Node:
- name, parent
| Method Attributes | Method Name and Description |
|---|---|
|
addNode(obj)
Adds a node to this layer.
|
|
|
draw(ctx)
Draws all the visual nodes to the layer's canvas.
|
|
|
eventsCallback(type, evt)
Handles all events sent to this layer.
|
|
|
getNode(name)
Returns the node with the given name.
|
|
|
getNodesByType(type)
Get child nodes based on the type
|
|
|
pointInBounds(point)
|
|
|
removeNode(name)
Removes a node from this layer.
|
|
|
update(elapsed)
Updates layer's child nodes.
|
- Methods borrowed from class pulse.Visual:
- addAction, calculateProperties, getAction, move, on, runAction
| Event Attributes | Event Name and Description |
|---|---|
|
click(evt)
Event rose when mouse button is clicked while pointer is over this layer.
|
|
|
mousedown(evt)
Event rose when mouse button is pressed down while pointer is overthis layer.
|
|
|
mousemove(evt)
Event rose when mouse is moved while pointer is over this layer.
|
|
|
mouseout(evt)
Event rose when mouse leaves this layer.
|
|
|
mouseover(evt)
Event rose when mouse pointer enters this layer.
|
|
|
mouseup(evt)
Event rose when mouse button is released while pointer is over this layer.
|
|
|
mousewheel(evt)
Event rose when mouse wheel is scrolled while pointer is over this layer.
|
|
|
touchend(evt)
Event rose when the user releases their touch on the node.
|
|
|
touchmove(evt)
Event rose when the user scrolls while tapping on the node.
|
|
|
touchstart(evt)
Event rose when the user presses down on the node.
|
Class Detail
pulse.Layer(params)
Layers are the heart of the engine, as they are base canvas for drawingobjects. Tney are literally a collection of sprites that are drawn withina specific area. A collection of layers make up each scene.
- Parameters:
- {object} params
- parameters that can be set as initialized optionson the node
- {string} params.name Optional
- name of the node
- {size} params.size Optional
- initial size, width and height, to use for the layer
- params.(number)
- [x] the horizontal position of the layer, relative to thescene bounds.
- {number} params.y Optional
- the vertical position of the layer, relative to thescene.
Field Detail
objects
Associative array (object) of the nodes in this layer.
Method Detail
addNode(obj)
Adds a node to this layer.
- Parameters:
- {object} obj
- the object to add
draw(ctx)
Draws all the visual nodes to the layer's canvas. Then draw's this layerto the passed in context.
- Parameters:
- {CanvasRenderingContext2D} ctx
- the context in which to draw thiscanvas on
eventsCallback(type, evt)
Handles all events sent to this layer. It will check to see if any of thechild sprites need to be notified about the event. If so it will pass itto them.
- Parameters:
- {string} type
- the type of event raised
- {object} evt
- the event object with properties on the event
{object}
getNode(name)
Returns the node with the given name.
- Parameters:
- {string} name
- the name of the sprite to return.
- Returns:
- {object} the node by name
{object}
getNodesByType(type)
Get child nodes based on the type
- Parameters:
- {object} type
- the type of nodes to retrieve
- Returns:
- {object} associative array of objects
pointInBounds(point)
- Parameters:
- point
removeNode(name)
Removes a node from this layer.
- Parameters:
- {string} name
- the name of the node to remove
update(elapsed)
Updates layer's child nodes.
- Parameters:
- {number} elapsed
- time elapsed since last update call inmilliseconds
Event Detail
click(evt)
Event rose when mouse button is clicked while pointer is over this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mousedown(evt)
Event rose when mouse button is pressed down while pointer is overthis layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mousemove(evt)
Event rose when mouse is moved while pointer is over this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mouseout(evt)
Event rose when mouse leaves this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mouseover(evt)
Event rose when mouse pointer enters this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mouseup(evt)
Event rose when mouse button is released while pointer is over this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
mousewheel(evt)
Event rose when mouse wheel is scrolled while pointer is over this layer.
- Parameters:
- {pulse.MouseEvent} evt
- The mouse event.
touchend(evt)
Event rose when the user releases their touch on the node.
- Parameters:
- {pulse.TouchEvent} evt
- The touch event for dropped node.
touchmove(evt)
Event rose when the user scrolls while tapping on the node.
- Parameters:
- {pulse.TouchEvent} evt
- The touch event for dropped node.
touchstart(evt)
Event rose when the user presses down on the node.
- Parameters:
- {pulse.TouchEvent} evt
- The touch event for dropped node.
