Class: DisplayObject

DisplayObject

DisplayObject

new DisplayObject(parameters) → {DisplayObject}

The base object for all items in the scene.
Parameters:
Name Type Description
parameters Object An object for initializing the DisplayObject. This object may contain the following properties: visible, alpha, tint, x, y, material, mainTexture, secTexture, width, height, name, anchorX, and anchorY.
Author:
  • thegoldenmule
Source:
Returns:
Type
DisplayObject
Example
var sprite = new Shape({
     x: 10,
     y: 100,
     tint: new Color(0, 1, 0)
});

Members

alpha :number

A value between 0 and 1 that determines the alpha of this DisplayObject.
Type:
  • number
Source:

geometry :Quad

The IGeometry implementation for this DisplayObject. Defaults to Quad.
Type:
  • Quad
Source:

material :Material

The Material instance with chich to render this DisplayObject.
Type:
  • Material
Source:

name :string

A non-unique name.
Type:
  • string
Source:

tint :Color

A Color to tint this DisplayObject.
Type:
  • Color
Source:

transform :Transform

The transform component to apply to this DisplayObject.
Type:
  • Transform
Source:

visible :boolean

Toggles the visibility of this DisplayObject and all children.
Type:
  • boolean
Source:

Methods

addChild(child) → {DisplayObject}

Adds a DisplayObject as a child of this one.
Parameters:
Name Type Description
child DisplayObject A DisplayObject instance to add as a child.
Source:
Returns:
Type
DisplayObject

addChildren(children)

Adds a list of DisplayObjects as children.
Parameters:
Name Type Description
children Array an array of DisplayObjects to add as children.
Source:

getChildByName(name) → {DisplayObject}

Returns a child by name, or null if no child by that name exists.
Parameters:
Name Type Description
name String The name of the child to return.
Source:
Returns:
Type
DisplayObject

getChildren() → {Array}

Retrieves a copy of the array of children for this DisplayObject.
Source:
Returns:
Type
Array

getHeight() → {number}

Returns the local height of the underlying geometry.
Source:
Returns:
Type
number

getParent() → {DisplayObject}

Retrieves the parent DisplayObject.
Source:
Returns:
Type
DisplayObject

getUniqueId() → {number}

All DisplayObject instances are assigned an id at instantiation that is unique across all DisplayObject instances. This function returns that value.
Source:
Returns:
Type
number

getWidth() → {number}

Returns the local width of the underlying geometry.
Source:
Returns:
Type
number

recalculateWorldMatrix() → {mat4}

Calculates the world matrix of this DisplayObject and returns it.
Source:
Returns:
Type
mat4

removeAllChildren()

Removes all children from this DisplayObject.
Source:

removeChild(child) → {DisplayObject}

Removes a DisplayObject from the list of children.
Parameters:
Name Type Description
child DisplayObject A DisplayObject instance to remove
Source:
Returns:
Type
DisplayObject

removeChildren(children)

Removes a list of DisplayObjects as children.
Parameters:
Name Type Description
children
Source:

removeFromParent()

Safely removes this DisplayObject from its parent.
Source: