# Two.Points
Extends: Two.Shape
This is a primary primitive class for quickly and easily drawing points in Two.js. Unless specified methods return their instance of Two.Points
for the purpose of chaining.
# Constructor
Argument | Description |
---|---|
vertices | A list of Two.Vectors that represent the order and coordinates to construct a rendered set of points. |
# sizeAttenuation
Two.Points.sizeAttenuation
Boolean dictating whether Two.js should scale the size of the points based on its matrix hierarchy.
Set to true
if you'd like the size of the points to be relative to the scale of its parents; false
to disregard. Default is false
.
# beginning
Two.Points.beginning
Number between zero and one to state the beginning of where the path is rendered.
Two.Points.beginning is a percentage value that represents at what percentage into the path should the renderer start drawing.
# ending
Two.Points.ending
Number between zero and one to state the ending of where the path is rendered.
Two.Points.ending is a percentage value that represents at what percentage into the path should the renderer start drawing.
# fill
Two.Points.fill
The value of what the path should be filled in with.
See: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value (opens new window) for more information on CSS's colors as String
.
# stroke
Two.Points.stroke
The value of what the path should be outlined in with.
See: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value (opens new window) for more information on CSS's colors as String
.
# className
Two.Points.className
A class to be applied to the element to be compatible with CSS styling.
# vertices
Two.Points.vertices
An ordered list of vector points for rendering points.
A list of Two.Vector objects that consist of which coordinates to draw points at.
# dashes
Two.Points.dashes
Array of numbers. Odd indices represent dash length. Even indices represent dash space.
A list of numbers that represent the repeated dash length and dash space applied to the stroke of the text.
See: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray (opens new window) for more information on the SVG stroke-dasharray attribute.
# clone
Two.Points.clone
Returns: Two.Points
Argument | Description |
---|---|
parent | The parent group or scene to add the clone to. |
Create a new instance of Two.Points with the same properties of the current path.
# toObject
Two.Points.toObject
Returns: Object
Return a JSON compatible plain object that represents the points object.
# corner
Two.Points.corner
Orient the vertices of the shape to the upper left-hand corner of the points object.
# getBoundingClientRect
Two.Points.getBoundingClientRect
Returns: Object
- Returns object with top, left, right, bottom, width, height attributes.
Argument | Description |
---|---|
shallow | Describes whether to calculate off local matrix or world matrix. |
Return an object with top, left, right, bottom, width, and height parameters of the path.
# subdivide
Two.Points.subdivide
Argument | Description |
---|---|
limit | How many times to recurse subdivisions. |
Insert a Two.Vector at the midpoint between every item in Two.Points.vertices.