You can easily set the dash pattern for the stroke of a shape.
To set the pattern, specify an array of at least 1 value. The pattern repeats itself so even-count arrays will be symmetric, where odd-count arrays will alternate the occurrence of strokes and dashes.
The order of the strokes and gaps looks like this:
[stroke, gap, stroke, gap, ...]