DiscPointsSource

← prev index next →

Scatters clones over a flat disc or annular ring — the way to array copies in concentric rings on a circular patch, with an optional hole in the middle.

Remarks

This is the disc-surface member of the points-source family: a points-source defines the set of positions at which a sk-cloner places copies of its content, so it lives as a child of a <sk-cloner> and the cloner's other child is the template that gets cloned at each point. Because the positions are generated procedurally in the shader (see ShaderFunctionPointsSource), a densely subdivided disc costs the same handful of parameters as a sparse one.

Key attributes. outer-radius sets the disc's outer edge and inner-radius its inner edge — leave inner-radius at 0 for a solid disc (with a single centre point) or set it above 0 to punch a hole and make a ring. radial-segments sets how many rings lie between the inner and outer radius (how far apart the concentric rings are), and rotation-segments sets how many points sit around each ring (the angular resolution). orientation is the axis the disc faces — the axis perpendicular to its plane, one of +x, -x, +y, -y, +z, -z — so +y lays the disc flat and +z stands it up facing the camera. center offsets the disc from the origin.

Related. For a rectangular flat patch use sk-plane-points-source; for the rim of a tube use sk-cone-points-source (which caps into a disc at its ends), and for a full donut use sk-torus-points-source. For a volumetric lattice see sk-grid-points-source. To scatter over an arbitrary object's surface rather than an analytic disc, see sk-mesh-surface-points-source. Its host is always a sk-cloner.

Constructor

constructor(config?: { innerRadius?: number; outerRadius?: number; radialSegments?: number; rotationSegments?: number; orientation?: AxisOrientation; center?: [number, number, number] })

Properties

Config Properties

PropertyTypeDefaultDescriptionDeclared by
innerRadius number 0 Inner radius of the disc. DiscPointsSource
outerRadius number 1.0 Outer radius of the disc. DiscPointsSource
radialSegments number 1 Number of radial segments. DiscPointsSource
rotationSegments number 8 Number of rotation segments. DiscPointsSource
orientationanimatable AxisOrientation "+y" Axis perpendicular to the disc. DiscPointsSource
center [number, number, number] [0, 0, 0] Disc center position. DiscPointsSource

Other Properties

PropertyTypeDefaultDescriptionDeclared by
pointCountread-only number Number of points provided by this source. ShaderFunctionPointsSource
localMatricesread-only Float32Array<ArrayBufferLike> | null CPU-side local matrices. ShaderFunctionPointsSource
typeread-only PointsSourceType "shader-function" The type of this points source. ShaderFunctionPointsSource
sceneread-only any Gets the Scene this animatable belongs to, if any. SkenraAnimatable
animationsread-only SkenraAnimation[] Public getter for the animations affecting this target. SkenraAnimatable

Methods

MethodDescriptionDeclared by
getBoundsInSpace(fullTransform: Float32Array): { minX: number; maxX: number; minY: number; maxY: number; minZ: number; maxZ: number; } | null Computes the AABB in target space by transforming local bounds corners. ShaderFunctionPointsSource
setWorldReferenceNode(node: WorldReferenceNode | null): void Sets the reference node whose world matrix should be used for transforms. ShaderFunctionPointsSource
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation Creates a new SkenraAnimation for this target per Web Animations API. SkenraAnimatable
removeAnimation(animation: SkenraAnimation): boolean Removes a specific animation from this object. SkenraAnimatable
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] Creates a constraint on this Animatable using a fluent API. SkenraAnimatable

Example

// Create points on a ring
const discSource = new DiscPointsSource({
    innerRadius: 0.5,
    outerRadius: 1.0,
    radialSegments: 2,
    rotationSegments: 16,
    orientation: '+y'
});

const cloner = new Cloner({ id: 'ring-cloner',
    pointsSource: discSource,
    alignToNormal: true // Clones point upward from disc surface
});