SVG Stroke Dasharray Cycle Normalizer
Normalize an odd SVG dash list by duplication and retain an all-zero solid-stroke condition; not an automatic dash renderer.
Description
Normalize an odd SVG dash list by duplication and retain an all-zero solid-stroke condition; not an automatic dash renderer.
An odd-length SVG dash sequence repeats twice to restore alternating dash/gap roles. A zero total has a separate solid-stroke interpretation.1
When to use this tool
Normalize an odd SVG dash list by duplication and retain an all-zero solid-stroke condition; not an automatic dash renderer.
- Prepare the supplied dashArray fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter dashArray. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.normalized, result.cycleLength, result.solidBecauseAllZero. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require a nonempty list of nonnegative dash lengths. Duplicate the list if its count is odd, otherwise copy it; sum normalized lengths and report solidBecauseAllZero when the total is zero.2
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| dashArray | dash array. | List of finite numbers; bounded by the operation |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.normalized | The normalized list in the ordering and representation described above. |
| result.cycleLength | The cycle length value under the stated formula or text convention. |
| result.solidBecauseAllZero | Flag for solid because all zero under the exact condition described above. |
{
"input": {
"dashArray": [
2,
1,
3
]
},
"output": {
"result": {
"normalized": [
2,
1,
3,
2,
1,
3
],
"cycleLength": 12,
"solidBecauseAllZero": false
}
}
} Limitations and assumptions
- Lengths are numeric user units, without percentages, offset handling or stroke rendering. No negative value or empty dash list is accepted.
- Point pairs use [x,y], rectangles and viewBox use [x,y,width,height], and all coordinate units must be consistent. This tool does not read, render or modify an SVG document.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Use a full SVG parser or rendering engine when the task includes commands and CSS values outside the documented branch. Compare coordinates and transforms under the same units and viewport convention.
References
Similar or alternative tools
- SVG Stroke Dasharray Number Parser
Parse the unitless finite-number SVG stroke-dasharray branch or none; lengths with units and percentages require a separate context.
- Absolute Line Command Differencer
Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.