<sk-stroke-paint>

← prev index next →

Draws a spline's path as a ribbon of a given width in a material — the way to render a curve as a visible stroke, and to animate a line drawing itself on.

Remarks

This is the stroke member of the Paint family: like every paint it applies a material to one part of a node's geometry; here that part is a spline's path, drawn as a line-strip ribbon. A single spline can carry several stroke paints, so a thin line can underlay a thicker animated one.

Key attributes. material (inherited from Paint) is the stroke's color. width is the ribbon width (animatable); width-space chooses its unit — screen (the default) keeps the width constant in pixels regardless of distance, while world measures it in world units so the stroke thins with perspective. pen-down and pen-up are the normalized arc-length start and end of the visible portion of the stroke (0 = path start, 1 = path end, both animatable and wrapping modularly): sweeping them draws a pulse along the curve or animates the whole line drawing itself on. line-cap shapes the stroke ends (round, butt, …).

Related. It strokes a sk-spline (whose shape comes from a spline-source). Its sibling paints cover the other parts of a node's geometry: sk-surface-paint (filled faces) and sk-edge-paint (mesh edges). The material it applies is a sk-plain-material.

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
id <id> The element's unique identifier — the standard HTML global id attribute.
materialanimatable <id-ref> Gets the material this paint applies. reference by id
widthanimatable <number> 1.0 Line width in pixels (screen space) or world units (world space).
pen-downanimatable <number> 0 Normalized arc-length position where the visible stroke begins.
pen-upanimatable <number> 1 Normalized arc-length position where the visible stroke ends.
line-capanimatable <stroke-line-cap> ("butt" | "round" | "square") "butt" Line cap style at stroke endpoints.
line-joinanimatable <stroke-line-join> ("miter" | "round" | "bevel") "miter" Line join style at corners between segments.
miter-limit <number> 4 Miter limit ratio for lineJoin: 'miter'.
width-spaceanimatable <stroke-space> ("screen" | "world") "screen" Width space mode for stroke rendering.
width-profileanimatable <width-profile> ({ <width-profile-basis> }) Width profile descriptor defining how stroke width varies along the path.
width-profile-precision <number> Number of linearized samples for width profiles.

Children

Optional stroke-field children (cross/dash-array/progress) plus optional spatial-field children.