<sk-torus-points-source>

← prev index next →

Scatters clones over the surface of a torus — the way to array copies around a donut, wrapping both the big ring and the tube.

Remarks

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

Key attributes. major-radius is the distance from the torus centre to the middle of the tube (how big the donut is), and minor-radius is the radius of the tube itself (how thick it is) — a small minor-radius gives a thin hoop, a large one a fat ring. major-segments sets how many points go around the big ring and minor-segments how many go around the tube's cross-section; together they set the surface density. orientation is the axis the ring lies flat against — the axis through the hole, one of +x, -x, +y, -y, +z, -z. center offsets the torus from the origin.

Related. For a straight capped tube use sk-capsule-points-source or sk-cone-points-source; for a flat ring with a hole (no tube) use sk-disc-points-source. Other closed surfaces include sk-sphere-points-source and sk-cube-points-source. To scatter over an arbitrary object's surface rather than an analytic torus, 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
major-radius <number> 1.0 Major radius: distance from torus center to tube center.
minor-radius <number> 0.3 Minor radius: radius of the tube cross-section.
major-segments <number> 16 Number of segments around the major circle/ring.
minor-segments <number> 12 Number of segments around the minor circle/tube.
orientationanimatable <orientation-axis> ("+x" | "-x" | "+y" | "-y" | "+z" | "-z") "+y" Axis perpendicular to the torus plane.
center <3d-position> ([<number>, <number>, <number>]) [0, 0, 0] Center position of the torus.