@zsnout/ithkuil
Version:
A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.
25 lines (24 loc) • 575 B
JavaScript
/**
* Scales an SVG path.
*
* @param path The path to be modified.
* @param scale The number to scale by.
* @returns The resulting path.
*/
export function scale(x, scale = 2) {
const all = x.split(" ");
return all
.map((text, index) => {
const value = +text;
if (isNaN(value) ||
index == 1 ||
index == 2 ||
all[index - 3] == "a" ||
all[index - 4] == "a" ||
all[index - 5] == "a") {
return text;
}
return scale * value;
})
.join(" ");
}