SpiralTrajectory

extends Path

The SpiralTrajectory class represents the Archimedean spiral curve a SpiralLayout places its children along – a pure visual guide, drawn from the same radius(t) = startRadius + radiusStep * t, angle(t) = startAngle + direction * angleStep * t formula the layout itself uses, just sampled densely instead of once per child. It never affects layout or data, and it recomputes automatically whenever the collection’s children are repositioned (e.g. after the data or the layout’s parameters change). To create a SpiralTrajectory, use the trajectory method in the Scene class, passing the laid-out collection (or any mark inside it):

let traj = scene.trajectory(collection);

Properties

propertyexplanationtypedefault value
collection the collection whose spiral layout this trajectory tracesCollection
extendPastLasthow many extra “child steps” worth of curve to draw past the last child (e.g. 1 continues the curve exactly one more step outward)Number0
id the unique id of the trajectoryString
points the sampled {x, y} points making up the curveArray
samplesPerStephow many points to sample between consecutive children – higher looks smoother but produces a longer d stringNumber12
type the type of the trajectoryString“trajectory”

Properties inherited from Path

propertyexplanationtypedefault value
bounds the bounding rectangle of the trajectoryRectangle
fillColorthe fill color of the trajectory pathColor“none”
strokeColorthe stroke color of the trajectoryColor“#bbb”
strokeDashthe dashes and gaps for the trajectory strokeString“none”
strokeWidththe stroke width of the trajectory in pixelsNumber1

Methods

methodexplanationreturn type
getSVGPathData()returns a string to be used as the d parameter in an SVG path elementString

Note that the trajectory is drawn behind the collection’s own marks (so points/icons placed by the spiral appear to sit on top of the curve), and only SpiralLayout is supported – CircularLayout’s “trajectory” would just be the circle implied by its evenly-spaced points, which is rarely useful as a drawn guide.