Constructor
new module:Path(positionDefinition, instructions, isClosedopt, optionsopt)
Path constructor
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
positionDefinition | PositionDefinition | Starting position of the Path | ||
instructions | Array.<Instruction> | | Set of instructions to follow to draw it | ||
isClosed | Boolean | <optional> | true | Should the path close itself (add a line to the starting position) |
options | ComponentOptions | | <optional> | Drawing options |
- Source
Extends
Methods
(static) arcTo(position, angle, magicRatio, clockwiseopt) → {Instruction}
Try to approximate an arc between two points
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position | PositionDefinition | Any position | ||
angle | Number | Arc angle in ratio of a full circle (should be less than 0.5) | ||
magicRatio | Number | Control points "openness" ratio | ||
clockwise | Boolean | <optional> | true | Should the arc be clockwise or not |
- Source
- Type:
- Instruction
(static) bezierTo(position, firstControlPoint, secondControlPoint) → {Instruction}
Draw a bezier curve to a position
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
firstControlPoint | PositionDefinition | First point to control the curve |
secondControlPoint | PositionDefinition | Second point to control the curve |
- Source
- Type:
- Instruction
(static) from(definition) → {Path}
Name | Type | Description |
---|---|---|
definition | Object | Path definition |
- Source
- Type:
- Path
(static) halfTo(position, clockwiseopt) → {Instruction}
Draw an quarter circle arc to a position
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position | PositionDefinition | Any position | ||
clockwise | Boolean | <optional> | true | Should the arc be clockwise or not |
- Source
- Type:
- Instruction
(static) lineTo(position) → {Instruction}
Draw a line to a position
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
- Source
- Type:
- Instruction
(static) moveTo(position) → {Instruction}
Move the pencil without drawing
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
- Source
- Type:
- Instruction
(static) quadTo(position, controlPoint) → {Instruction}
Draw a quadratic curve to a position
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
controlPoint | PositionDefinition | Point that control the curve |
- Source
- Type:
- Instruction
(static) quarterTo(position, clockwiseopt) → {Instruction}
Draw an quarter circle arc to a position
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position | PositionDefinition | Any position | ||
clockwise | Boolean | <optional> | true | Should the arc be clockwise or not |
- Source
- Type:
- Instruction
(static) sinTo(position, nbSins, sinsHeight) → {Instruction}
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
nbSins | Number | Number of sinusoid to draw |
sinsHeight | Number | Height of the sinusoid |
- Source
- Type:
- Instruction
(static) splineThrough(points, tensionopt) → {Instruction}
Name | Type | Attributes | Description |
---|---|---|---|
points | Array.<PositionDefinition> | Any set of positions | |
tension | Number | <optional> | Ratio of tension |
- Source
- Type:
- Instruction
(static) waveTo(position, nbWaves) → {Instruction}
Name | Type | Description |
---|---|---|
position | PositionDefinition | Any position |
nbWaves | Number | Number of waves to draw |
- Source
- Type:
- Instruction
trace(path) → {Path}
Draw the path
Name | Type | Description |
---|---|---|
path | Path2D | Current drawing path |
- Overrides
- Source
Itself
- Type:
- Path