# Two.Shape

Extends: Two.Element

The foundational transformation object for the Two.js scenegraph.

# 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.

# matrix

The transformation matrix of the shape.

nota-bene

Two.Shape.position, Two.Shape.rotation, Two.Shape.scale, Two.Shape.skewX, and Two.Shape.skewY apply their values to the matrix when changed. The matrix is what is sent to the renderer to be drawn.

# worldMatrix

The transformation matrix of the shape in the scene.

# position

The x and y value for where the shape is placed relative to its parent.

# rotation

The value in Number for how much the shape is rotated relative to its parent.

# scale

The value for how much the shape is scaled relative to its parent.

nota-bene

This value can be replaced with a Two.Vector to do non-uniform scaling. e.g: shape.scale = new Two.Vector(2, 1);

# skewX

The value in Number for how much the shape is skewed relative to its parent.

Skew the shape by an angle in the x axis direction.

# skewY

The value in Number for how much the shape is skewed relative to its parent.

Skew the shape by an angle in the y axis direction.

# addTo

Argument Description
group The parent the shape adds itself to.

Convenience method to add itself to the scenegraph.

# remove

Remove self from the scene / parent.

# clone

Returns: Two.Shape

Argument Description
parent Optional argument to automatically add the shape to a scenegraph.

Create a new Two.Shape with the same values as the current shape.