<sk-capsule-points-source>

← prev index next →

Scatters clones over the surface of a capsule — the way to array copies up a pill shape: a cylinder closed off by a rounded hemisphere at each end.

Remarks

This is the capsule-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 finely subdivided capsule costs the same handful of parameters as a coarse one.

Key attributes. radius is the capsule's tube and cap radius (its thickness), and height is the length of the straight cylindrical middle between the two rounded ends — the overall length is height plus a full radius cap at each end. height-segments sets how many rings run up the cylindrical body, cap-segments how many latitude rings make up each rounded cap (their roundness), and rotation-segments how many points sit around each ring (the angular resolution). orientation is the axis the capsule extends along — one of +x, -x, +y, -y, +z, -z. center offsets it from the origin. Only unique points are emitted — a single pole at each tip, no seam duplicates.

Related. For flat-capped tubes and cones use sk-cone-points-source; for a full donut use sk-torus-points-source, and for a plain ball use sk-sphere-points-source or sk-uv-sphere-points-source. To scatter over an arbitrary object's surface rather than an analytic capsule, see sk-mesh-surface-points-source. Its host is always a sk-cloner.

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.

Attributes

AttributeTypeDefaultDescription
radius <number> 1.0 Radius of the capsule.
height <number> 1.0 Height of the cylindrical portion.
height-segments <number> 1 Number of segments along the cylinder height.
cap-segments <number> 4 Number of latitude segments in each hemisphere cap.
rotation-segments <number> 8 Number of segments around the circumference.
orientationanimatable <orientation-axis> ("+x" | "-x" | "+y" | "-y" | "+z" | "-z") "+y" Axis along which the capsule extends.
center <3d-position> ([<number>, <number>, <number>]) [0, 0, 0] Center position of the capsule.