Description
Duplicate an odd-length array, sum the effective array as period, and normalize signed offset into [0, period).
A vector stroke has width as well as a centerline, and a dashed stroke alternates painted lengths and gaps. Pattern phase and visible clearance depend on these dimensions even before a path is rendered.
Duplicate an odd-length array, sum the effective array as period, and normalize signed offset into [0, period).
When to use this tool
Use Vector Stroke Dash Period Remainder when you need a numerical stroke allowance or repeating-pattern calculation before rendering.
How to use the tool and how it works
- Enter dashArray, offset. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read effectiveDashArray, period, normalizedOffset. Use the output convention below.
Require 1-128 nonnegative dashArray values with positive sum. Duplicate an odd-length array, sum the effective array as period, and normalize signed offset into [0, period).1
Odd dash lists repeat to make an even pattern. Unlike SVG solid-stroke handling, this tool rejects an all-zero pattern because no positive wrapping period exists.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| dashArray | Nonnegative alternating painted/gap lengths, 1-128 entries with positive sum; common stroke length unit. | Required. Array of finite number; maximum items 256. |
| offset | Signed phase displacement in the same length unit. | Required. Finite number. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| effectiveDashArray | Effective Dash Array | Required. Array of finite number; maximum items 256. |
| period | Period | Required. Finite number. |
| normalizedOffset | Offset modulo effective period in [0, period). | Required. Finite number. |
{
"input": {
"dashArray": [
3,
2,
1
],
"offset": -1
},
"output": {
"effectiveDashArray": [
3,
2,
1,
3,
2,
1
],
"period": 12,
"normalizedOffset": 11
}
} Limitations and assumptions
- Lengths and offset share units; no actual path, rendering, line caps, scaling, or dash visibility is evaluated and a zero-length element is allowed.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Inspect the result in the target vector renderer at final size. Curved paths, joins, caps, and rasterization may require geometry or visual checks beyond a local length calculation.
References
Similar or alternative tools
- Baseline Grid Half Step Rule
Normalize coordinate around origin, round to the nearest grid index, resolve exact half steps by the selected policy, and return index and snapped coordinate.
- Baseline Grid Phase Offset
Reduce baseline-origin modulo step into [0, step) and divide by step for fraction.