Class: DisplayObject3D

DisplayObject3D

(abstract) new DisplayObject3D()

The DisplayObject3D class is an abstract class that serves as the base for all 3D capable elements to be used within a dom3d Stage3D scene. It is not meant to be directly instantiated.

All DOM elements associated with any dom3d class that inherits from DisplayObject3D (with the exception of Stage3D class objects) should be assumed to operate with a CSS display of 'block' and a CSS position of 'absolute'.
Source:

Members

(readonly) element :HTMLElement

Every DisplayObject3D represents an HTML Element. You can access that element by accessing the object's element property. Conversely any element that has an associated DisplayObject3D will have a property .dom3dObject which references its DisplayObject3D.
Type:
  • HTMLElement
Default Value:
  • null
Source:

id :String

Each DisplayObject3D has a unique id property. When the element it represents has an id attribute at the time of instantiation it will match its element's id. Otherwise a unique one will be generated. You can also assign your own.
Type:
  • String
Default Value:
  • ""
Source:

(readonly) isDisplayObject3D :Boolean

Any dom3d object meant to be part of the display list/stage will have this property as true.
Type:
  • Boolean
Default Value:
  • true
Source:

(readonly) parent :DisplayObject3D

Each DisplayObject3D has a parent property that allows it to tell which object is currently this object's parent in the display list. Null if it is not in the display list.
Type:
Default Value:
  • null
Source:

rotX :Number

The rotX property sets the x-axis rotation value for the DisplayObject3D instance in degrees.

This property can be set automatically upon instantiation by having a data-rotX attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

rotY :Number

The rotY property sets the y-axis rotation value for the DisplayObject3D instance in degrees.

This property can be set automatically upon instantiation by having a data-rotY attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

rotZ :Number

The rotZ property sets the z-axis rotation value for the DisplayObject3D instance in degrees.

This property can be set automatically upon instantiation by having a data-rotZ attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) stage3D :Stage3D

Each DisplayObject3D has a stage3D property that allows it to tell which stage it is currently in the display list of. Is null when not in a display list.
Type:
Default Value:
  • null
Source:

x :Number

The x property sets the x coordinate value for the DisplayObject3D instance.

This property can be set automatically upon instantiation by either having a CSS style left property set in pixels, or a data-x attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

y :Number

The y property sets the y coordinate value for the DisplayObject3D instance.

This property can be set automatically upon instantiation by either having a CSS style top property set in pixels, or a data-y attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

z :Number

The z property sets the z coordinate value for the DisplayObject3D instance.

This property can be set automatically upon instantiation by having a data-z attribute on the element set to a number.
Type:
  • Number
Default Value:
  • 0
Source:

Methods

setX(value) → {DisplayObject3D}

setX (and likewise the setY, setZ, setRotX, setRotY, and setRotZ which are not documented because they operate the same as setX but for their respective properties) is a method that allows you to set the x coordinate value in a chainable way like is familiar in libraries such as jQuery. So myObj.setX(20).setY(20); is legitimate to set the x and y to 20. It also allows relative changes via a string using operators, such as "+=20", "*=2" or just "++" and "--" increments. This is much slower than just setting the properties, but useful nonetheless in some situations.
Parameters:
Name Type Description
value Number | String The new number value to set it to, or the string indicating the relative change to happen.
Source:
Returns:
Returns this DisplayObject3D for chaining purposes.
Type
DisplayObject3D