The Segment object represents a part of a path which is described by the path.segments array. Every segment of a path corresponds to an anchor point (anchor points are the path handles that are visible when the path is selected).
Constructors
Creates a new Segment object.
Sample code:
var handleIn = new Point(-40, -50); var handleOut = new Point(40, 50); var firstPoint = new Point(100, 50); var firstSegment = new Segment(firstPoint, null, handleOut); var secondPoint = new Point(200, 50); var secondSegment = new Segment(secondPoint, handleIn, null); var path = new Path(); path.segments = [firstSegment, secondSegment];
- Parameters:
- pt: Point — the anchor point of the segment — optional
- handleIn: Point — the handle point relative to the anchor point of the segment that describes the in tangent of the segment. — optional, default: x: 0, y: 0
- handleOut: Point — the handle point relative to the anchor point of the segment that describes the out tangent of the segment. — optional, default: x: 0, y: 0
- Returns:
- Segment
Creates a new Segment object.
Sample code:
var handleIn = new Point(-40, -50); var handleOut = new Point(40, 50); var firstSegment = new Segment(100, 50, 0, 0, handleOut.x, handleOut.y); var secondSegment = new Segment(200, 50, handleIn.x, handleIn.y, 0, 0); var path = new Path(); path.segments = [firstSegment, secondSegment];
- Parameters:
- x: Number — the x coordinate of the anchor point of the segment
- y: Number — the y coordinate of the anchor point of the segment
- inX: Number — the x coordinate of the handle point relative to the anchor point of the segment that describes the in tangent of the segment. — optional, default: 0
- inY: Number — the y coordinate of the handle point relative to the anchor point of the segment that describes the in tangent of the segment. — optional, default: 0
- outX: Number — the x coordinate of the handle point relative to the anchor point of the segment that describes the out tangent of the segment. — optional, default: 0
- outY: Number — the y coordinate of the handle point relative to the anchor point of the segment that describes the out tangent of the segment. — optional, default: 0
- Returns:
- Segment
Properties
Hierarchy
The index of the segment in the path.segments array that the segment belongs to. Read-only.
- Returns:
- Number
Sibling Segments
The next segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the first segment is returned for the last segment of the path. Read-only.
- Returns:
- Segment
The previous segment in the path.segments array that the segment belongs to. If the segments belongs to a closed path, the last segment is returned for the first segment of the path. Read-only.
- Returns:
- Segment