PointsSplineSource

← prev index next →

Turns a list of 3D control points into a smooth spline curve — the way to define a curve from explicit positions (a Bézier, B-spline, Catmull-Rom, or polyline) rather than from vector artwork.

Remarks

This is the control-points member of the spline-source family: a spline-source supplies the curve geometry for a AbstractSpline, so it lives as the single geometry child of a sk-spline (or is built into a sk-points-spline, the convenience leaf that wraps this source behind points). Once hosted, the curve draws with a stroke paint, carries an sk-align-to-spline-constraint, or seeds points and fields — like any spline.

Key attributes. points is the list of [x, y, z] control points — full 3D, so the curve is not confined to a plane. basis chooses how the curve threads them: bezier treats them as Bézier control handles, bspline produces a taut approximating curve, catmullRom passes smoothly through every point, and linear connects them with straight segments. wrap sets the endpoint behaviour — open leaves a curve with two ends, closed joins the last point back to the first into a loop, and pinned clamps the curve to touch its first and last control points. widths is an optional list parallel to points that tapers the stroke's cross-section along the curve (absent → uniform width). A spline-source is also a points-source, so a sk-cloner given one as its points-source places clones along the curve; distribution then selects the sampling — control-points (one per authored point, the default), tessellated (one per polyline vertex), or arc-length-spaced (distribution-count evenly-spaced samples).

Related. It is one input modality of the spline-source family alongside sk-svg-spline-source (SVG path data), sk-morph-spline-source (blend two sources), sk-trail-spline-source (a moving node's wake), and the GPU sources sk-compute-buffer-spline-source / sk-custom-wgsl-spline-source. Its host is a sk-spline; the built-in shortcut for control-point input is sk-points-spline.

Constructor

constructor(config?: { points: Point3D[]; basis?: BasisType; wrap?: WrapType; widths?: number[] })

Properties

Config Properties

PropertyTypeDefaultDescriptionDeclared by
points Point3D[] The 3D control points. PointsSplineSource
basis BasisType The curve basis type. PointsSplineSource
wrap WrapType The wrap mode. PointsSplineSource
widths number[] The optional per-control-point widths (parallel to points). PointsSplineSource

Other Properties

PropertyTypeDefaultDescriptionDeclared by
vertexCountread-only number PointsSplineSource
isValidread-only boolean Whether the source is valid (initialized without errors and has vertices). PointsSplineSource
isClosedread-only boolean PointsSplineSource
polylineread-only readonly Readonly<SplinePoint>[] PointsSplineSource
pointCountread-only number Cloner-facing point count. Tracks distribution: equals AbstractSplineSource
localMatricesread-only Float32Array<ArrayBufferLike> | null AbstractSplineSource
distribution SplineDistributionMode AbstractSplineSource
distributionCount number AbstractSplineSource
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
pointAt(t: number): SplinePoint | null Returns a point on the spline at normalized parameter t. PointsSplineSource
getBoundsInSpace(fullTransform: Float32Array): PolylineBounds | null PointsSplineSource
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

const source = new PointsSplineSource({
    points: [[0,0,0], [1,2,0], [2,1,1], [3,0,0]],
    basis: 'bezier',
});