Created
August 9, 2020 09:12
-
-
Save katef/34b7c81b0c45f65edf4bf24c2dd5e222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
function line(x1, y1, x2, y2) { | |
printf(" <line x1='%d' y1='%d' x2='%d' y2='%d'/>\n", | |
x1, y1 + rand() * 5, x2, y2 + rand() * 10) | |
} | |
function path(d) { | |
printf(" <path d='%s'/>\n", d) | |
} | |
function ellipse(cx, cy, rx, ry) { | |
printf(" <ellipse cx='%d' cy='%d' rx='%d' ry='%d'/>\n", | |
cx, cy, rx, ry + rand() * 5) | |
} | |
function circle(cx, cy, r) { | |
ellipse(cx, cy, r, r) | |
} | |
BEGIN { | |
print "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" | |
print "" | |
print "<svg" | |
print " xmlns='http://www.w3.org/2000/svg'" | |
print " width='90mm'" | |
print " height='100mm'" | |
print " viewBox='0 0 100 110'" | |
print " version='1.1'>" | |
print "" | |
print " <style>path, circle, line, ellipse { fill: none; stroke: white; stroke-width: 0.4; }</style>" | |
print "" | |
print " <g transform='translate(0,-187)'>" | |
} | |
{ | |
srand(seed + $1) | |
# hair | |
path("m 10,213 c 20,5 38,-10 45,-22"); | |
# head | |
circle(49, 222, 30) | |
ellipse(40, 214, 7, 12) | |
ellipse(64, 212, 7, 11) | |
line(46 + rand() * 5, 230, 63, 229 + rand() * 5) | |
# arms | |
line(15, 252, 39, 264) | |
line(87, 248, 61, 262) | |
# legs | |
line(43, 281, 41, 295) | |
line(60, 279, 65, 290) | |
# dress | |
path("m 38,252 l -13,30 50,-5 -17,-25") | |
} | |
END { | |
print " </g>" | |
print "</svg>" | |
} |
Author
katef
commented
Aug 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment