layer = color => array(30).map(() => {
const nbRects = randInt(5, 25)
const rad = randInt(2, 8) * 60
const rw = randInt(4, 15)
const rh = randInt(5, 100)
const startAngle = random(720)
const stepAngle = randInt(Math.max(1, rw - rad / 60), rw/2)
const nbHashes = random(0.05, 0.4) * rh | 0
return array(nbRects).map(i => {
return `<g transform="translate(${w/2}, ${h/2}) rotate(${startAngle + i * stepAngle}) translate(0, ${rad - rh/2})">
<rect
x="${-rw/2}" y="0"
width="${rw}"
height="${rh}"
stroke="${color}"
fill="none"
/>
${array(nbHashes).map(j => {
const y = map(j, -1, nbHashes, 0, rh)
return `<line
x1="-${rw / 2}"
y1="${y}"
x2="${rw / 2}"
y2="${y}"
stroke="${color}"
/>`
}).join('\n')}
</g>`
}).join('\n')
}).join('\n')