SpiralLayout

extends Layout

The SpiralLayout class represents a layout that positions objects along an Archimedean spiral around a center point: each successive child sits at a slightly larger radius and a further-rotated angle than the one before it (radius(i) = startRadius + radiusStep * i, angle(i) = startAngle + direction * angleStep * i). To create a SpiralLayout object and apply it to a collection, use the layout function:

let sl = msc.layout("spiral", {x: 200, y: 200, startRadius: 10, radiusStep: 8, angleStep: 40});
collection.layout = sl;

Properties

propertyexplanationtypedefault value
angleStepthe angle (in degrees) added between consecutive childrenNumber40
directionthe AngularDirection the spiral winds in (“clockwise” or “anti-clockwise”)String“clockwise”
markRotationhow each child is oriented as it’s placed along the spiral: "outward" (faces away from center), "inward" (faces toward center), "tangentialClockwise" / "tangentialCounterClockwise" (faces along the tangent, in that direction of travel), or "upright" (orientation never changes, regardless of position)String“tangential”
radiusStepthe amount the radius grows between consecutive childrenNumber8
refElements the reference elements used by this layoutArray[]
startAnglethe angle (in degrees) of the first childNumber0
startRadiusthe radius of the first childNumber0
typethe type of the layoutString“spiral”
xthe x coordinate of the spiral’s centerNumber100
ythe y coordinate of the spiral’s centerNumber100

Methods

methodexplanationreturn type
clone()returns a copy of this layoutSpiralLayout

Methods inherited from Layout

methodexplanationreturn type
addRefElement(re)adds a reference element to this layoutvoid
clearRefElements()removes all reference elements from this layoutvoid