<sk-dash-array-stroke-field>

← prev index next →

Chops a stroke into a repeating dash pattern — the field for dashed and dotted lines, marching-ants borders, and ticked paths.

Remarks

This is the dash-pattern member of the StrokeField family: like every field it turns where into how much — a scalar weight consumers read by #id (field="#id") — but a stroke field is defined only along a stroke (see the general SpatialField concept for position-based fields). Here the weight follows arc-length (strokeCoord.x), repeating an on/off cycle so a solid stroke reads as evenly spaced dashes.

Key attributes. segment-length is the length of one on+off cycle in stroke units; on-fraction is the share of each cycle that is "on" (weight 1) versus the gap (weight 0); and softness softens the on↔off edges. An offset shifts the pattern along the stroke — offsetting a second stroke by half a cycle interleaves two dash patterns so one fills the other's gaps, and animating offset marches the dashes along the path.

Related. Sibling stroke fields: sk-progress-stroke-field (a single start→end ramp) and sk-cross-stroke-field (fade across the width). The usual consumer is a sk-tonemap applied through a sk-stroke-paint.

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.
remap-curveanimatable <remap-curve> Optional curve that reshapes this field's raw [0, 1] output.
remap-phaseanimatable <number> 0 Horizontal remap phase — an animatable scalar that translates a present
segment-lengthanimatable <number> Length of each repeating segment.
on-fractionanimatable Fraction of each segment that is "on" [0, 1].
softnessanimatable <number> Smoothness of transitions between on/off.
offsetanimatable <number> Phase offset within the segment [0, 1]. Shifts the on/off pattern.