class Geometry · Computations

SeparateCirclesOptions

Options for Separate.circles (circles that move in any direction).

All fields are optional. Numbers can be given as plain numbers or as reactive values; the value they hold when the function runs is used.

Properties

iterationsoptional

iterations?: number

How long the circles may settle at most when there is no previous (default 10); fewer rounds are used when they settle earlier. Not used with previous, so updates stay fast.

obstaclesoptional

obstacles?: Circle[]

Circles that are not moved but kept clear of, e.g. the one the user drags. They are not part of the result.

paddingoptional

padding?: number | Real

The smallest gap between two circles (default 0).

previousoptional

previous?: (Circle | null | undefined)[]

The layout of the last update, one entry per circle in the same order (usually the last result), or null / undefined (or missing at the end) for a circle without one. Each update starts from that layout while the circles' own positions stay the goal: the arrangement (which circle lies on which side of which) stays where nothing pushes, so clusters don't flip from one side to the other, and a circle whose position lies beyond others goes round them. Over a few calls the layout may still settle a little, and with the same input it comes to rest; animate the circles towards the result (e.g. Animate.shape.followAll) for smooth motion.

spacingoptional

spacing?: number | Real

A preferred gap between two circles on top of padding (default 0: as compact as possible). The circles are pushed apart up to padding + spacing, held against the pull to their own positions, so the gaps grow where there is room and shrink down to padding where the circles press on each other.

weightsoptional

weights?: number[]

One weight per circle, in the order of the circles: a circle with a higher weight moves less, one with weight Infinity stays where it is, one with weight 0 moves freely. A missing weight (or NaN) counts as 1.

withinoptional

within?: Within

The area the circles stay in: a polygon (also a box, rectangle or triangle), a circle, or both (then they stay in both). Without it, the circles may move anywhere.