Props
Array of path command types defining the operations to perform.Use
PathCommand constants:PathCommand.MoveTo- Move to a point without drawingPathCommand.LineTo- Draw a line to a pointPathCommand.CubicTo- Draw a cubic Bezier curvePathCommand.Close- Close the path
[PathCommand.MoveTo, PathCommand.LineTo, PathCommand.Close]Array of points corresponding to the commands. Each command consumes a different number of points:
MoveTo: 1 point(x, y)LineTo: 1 point(x, y)CubicTo: 3 points(x1, y1),(x2, y2),(x, y)for control points and end pointClose: 0 points
[{ x: 0, y: 0 }, { x: 100, y: 100 }]The number of points must match the requirements of the commands array. A mismatch will cause rendering errors.
Usage
Triangle
Star Shape
Bezier Curve
Complex Path
Open Path (No Fill)
Parent-Child Relationships
- Parent: Must be a child of Shape
- Children: Path does not accept children
All coordinates are relative to the parent Shape’s transform. The path matches the
appendPath API from the ThorVG bindings package.Path Commands Reference
| Command | Points Required | Description |
|---|---|---|
PathCommand.MoveTo | 1 | Move to point without drawing |
PathCommand.LineTo | 1 | Draw straight line to point |
PathCommand.CubicTo | 3 | Draw cubic Bezier curve with two control points |
PathCommand.Close | 0 | Close path to starting point |
TypeScript Interface
packages/fiber/src/types.ts:205-223