Two.Element

Extends: Two.Events

The foundational object for the Two.js scenegraph.

fromObject

Returns: Two.Element

ArgumentDescription
objObject notation of a Two.Element to create a new instance

Create a new Two.Element from an object notation of a Two.Element.

nota-bene

Works in conjunction with Two.Element.toObject

renderer

Object access to store relevant renderer specific variables. Warning: manipulating this object can create unintended consequences.

nota-bene

With the Two.SVGRenderer you can access the underlying SVG element created via shape.renderer.elem.

id

Session specific unique identifier.

nota-bene

In the Two.SVGRenderer change this to change the underlying SVG element's id too.

className

A class to be applied to the element to be compatible with CSS styling.

nota-bene

Only rendered to DOM in the SVG renderer.

classList

A list of class strings stored if imported / interpreted from an SVG element.

flagReset

Called internally by Two.js's renderer to reset all flags. Ensures that only properties that change are updated before being sent to the renderer.

dispose

Release the element's renderer object and detach any events. This cleans up renderer-specific resources and unbinds all event listeners.