Two.Shape
Extends: Two.Element
The foundational transformation object for the Two.js scenegraph.
fromObject
Two.Shape.fromObject
Returns: Two.Shape
| Argument | Description |
|---|---|
| obj | Object notation of a Two.Shape to create a new instance |
renderer
Two.Shape.renderer
Object access to store relevant renderer specific variables. Warning: manipulating this object can create unintended consequences.
rotation
Two.Shape.rotation
The value in Number for how much the shape is rotated relative to its parent.
skewX
Two.Shape.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
Two.Shape.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
Two.Shape.addTo
| Argument | Description |
|---|---|
| group | The parent the shape adds itself to. |
Convenience method to add itself to the scenegraph.
contains
Two.Shape.contains
Returns: Boolean
| Argument | Description |
|---|---|
| x | x coordinate to hit test against |
| y | y coordinate to hit test against |
| options | Optional options object |
| options.ignoreVisibility | If true, hit test against shape.visible = false shapes |
| options.tolerance | Padding to hit test against in pixels |
Check to see if coordinates are within a Two.Shape's bounding rectangle
clone
Two.Shape.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.