Skip to main content

repeat()

Creates linear repeated instances along an axis.

Returns: SceneObject

tip

See the guide for detailed usage examples.

Signatures

repeat(type: "linear", axis: AxisLike, options: LinearRepeatOptions, ...objects: SceneObject[]): SceneObject

Creates linear repeated instances along an axis.

ParameterTypeDescription
type"linear"Must be 'linear'
axisAxisLikeThe axis to repeat along
optionsLinearRepeatOptionsRepeat count, spacing, etc.
...objectsSceneObject[]The objects to repeat (defaults to last object) (optional)

repeat(type: "linear", axis: AxisLike[], options: LinearRepeatOptions, ...objects: SceneObject[]): SceneObject

Creates linear repeated instances along multiple axes.

ParameterTypeDescription
type"linear"Must be 'linear'
axisAxisLike[]The axes to repeat along
optionsLinearRepeatOptionsRepeat count, spacing, etc.
...objectsSceneObject[]The objects to repeat (defaults to last object) (optional)

LinearRepeatOptions

PropertyTypeDescription
countnumber | number[]Number of instances per axis (including the original)
offsetnumber | number[]Spacing between each instance. Cannot be used with length. (optional)
lengthnumber | number[]Total span to distribute instances across (evenly spaced). Cannot be used with offset. (optional)
centeredbooleanWhen true, centers the pattern around the original object's position (optional)
skipnumber[][]Index tuples to skip (e.g. [[1], [3]] for single axis, [[1, 2]] for multi-axis) (optional)

repeat(type: "circular", axis: AxisLike, options: CircularRepeatOptions, ...objects: SceneObject[]): SceneObject

Creates circular repeated instances around an axis.

ParameterTypeDescription
type"circular"Must be 'circular'
axisAxisLikeThe axis to repeat around
optionsCircularRepeatOptionsRepeat count, angle, etc.
...objectsSceneObject[]The objects to repeat (defaults to last object) (optional)

CircularRepeatOptions

PropertyTypeDescription
countnumberNumber of instances (including the original)
anglenumberTotal angle to spread across. Cannot be used with offset. (optional)
offsetnumberAngle between each instance. Cannot be used with angle. (optional)
centeredbooleanWhen true, centers the pattern around the original object's position (optional)
skipnumber[]Indices to skip (e.g. [2, 4] to skip the 3rd and 5th instances) (optional)

repeat(type: "mirror", plane: PlaneLike, ...objects: SceneObject[]): SceneObject

Creates a mirrored instance of objects across a plane.

ParameterTypeDescription
type"mirror"Must be 'mirror'
planePlaneLikeThe plane to mirror across
...objectsSceneObject[]The objects to mirror (defaults to last object) (optional)

repeat(type: "rotate", axis: AxisLike, angle?: number, ...objects: SceneObject[]): SceneObject

Creates a rotated clone of objects around an axis.

ParameterTypeDescription
type"rotate"Must be 'rotate'
axisAxisLikeThe axis to rotate around
anglenumberThe rotation angle in degrees (defaults to 90) (optional)
...objectsSceneObject[]The objects to rotate (defaults to last object) (optional)

repeat(matrix: Matrix4, ...objects: SceneObject[]): SceneObject

Creates a transformed clone of objects using an arbitrary matrix.

ParameterTypeDescription
matrixMatrix4The transformation matrix to apply
...objectsSceneObject[]The objects to transform (defaults to last object) (optional)