(parent)
| 1 | export default function addFilter(parent) { |
| 2 | parent.append('filter') |
| 3 | .attr('id', 'xkcdify') |
| 4 | .attr('filterUnits', 'userSpaceOnUse') |
| 5 | .attr('x', -5) |
| 6 | .attr('y', -5) |
| 7 | .attr('width', '100%') |
| 8 | .attr('height', '100%') |
| 9 | .call((f) => f.append('feTurbulence') |
| 10 | .attr('type', 'fractalNoise') |
| 11 | .attr('baseFrequency', '0.05') |
| 12 | .attr('result', 'noise')) |
| 13 | .call((f) => f.append('feDisplacementMap') |
| 14 | .attr('scale', '5') |
| 15 | .attr('xChannelSelector', 'R') |
| 16 | .attr('yChannelSelector', 'G') |
| 17 | .attr('in', 'SourceGraphic') |
| 18 | .attr('in2', 'noise')); |
| 19 | |
| 20 | parent.append('filter') |
| 21 | .attr('id', 'xkcdify-pie') |
| 22 | .call((f) => f.append('feTurbulence') |
| 23 | .attr('type', 'fractalNoise') |
| 24 | .attr('baseFrequency', '0.05') |
| 25 | .attr('result', 'noise')) |
| 26 | .call((f) => f.append('feDisplacementMap') |
| 27 | .attr('scale', '5') |
| 28 | .attr('xChannelSelector', 'R') |
| 29 | .attr('yChannelSelector', 'G') |
| 30 | .attr('in', 'SourceGraphic') |
| 31 | .attr('in2', 'noise')); |
| 32 | |
| 33 | // TODO bar chart hatch effect |
| 34 | // parent.append('pattern') |
| 35 | // .attr('id', 'hatch00') |
| 36 | // .attr('patternUnits', 'userSpaceOnUse') |
| 37 | // .attr('x', 0) |
| 38 | // .attr('y', 0) |
| 39 | // .attr('width', 10) |
| 40 | // .attr('height', 10) |
| 41 | // .call((f) => f.append('path') |
| 42 | // .attr('d', 'M3,0 l7,7 l0,-2 l-5,-5 l-2,0 M0,7 l3,3 l2,0 l-5,-5 l0,2') |
| 43 | // .attr('fill', colors[1]) |
| 44 | // .attr('stroke', 'none')); |
| 45 | } |
no outgoing calls
no test coverage detected