Path
The Path
class represents an SVG path element. It allows you to set the path data and provides computed properties based on the coordinates within the path.
Info
This class inherits from SvgElement
.
pydreamplet.core.Path
Initializes a new path with an optional d attribute containing path commands.
Parameters
d
(str, optional): The path data string.**kwargs
: Additional attributes for the path element.
from pydreamplet import SVG, Path
from pydreamplet.shapes import star
svg = SVG(200, 200)
svg.append(
Path(
d=star(svg.w / 2, svg.h / 2, inner_radius=30, outer_radius=80, angle=-18),
fill="#a00344",
)
)
d
Getter: Returns the path data string.
Setter: Updates the path data.
w
Returns the width of the path based on the extracted coordinates.
h
Returns the height of the path based on the extracted coordinates.
center
Returns the center point of the path as a Vector
.