charge svg, space out randomly generated points
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
const preact = require('preact');
|
||||
|
||||
module.exports = function charge(x, y, height, colour) {
|
||||
return (
|
||||
<svg>
|
||||
<polygon
|
||||
points={`
|
||||
${x},${y - height}
|
||||
${x - 2 * height},${y + 2 * height}
|
||||
${x + 2 * height},${y + 2 * height}
|
||||
`}
|
||||
stroke="#a52a2a"
|
||||
stroke-width="2"
|
||||
id="charge"
|
||||
/>
|
||||
<polyline
|
||||
points={`
|
||||
${x + 2 * height},${y + 2 * height}
|
||||
${x + 3.5 * height},${y + height}
|
||||
${x},${y - 4 * height}
|
||||
${x - 3.5 * height},${y + height}
|
||||
${x - 2 * height},${y + 2 * height}
|
||||
`}
|
||||
stroke="#a52a2a"
|
||||
stroke-width="2"
|
||||
id="charge"
|
||||
/>
|
||||
<polyline
|
||||
points={`
|
||||
${x + 3.5 * height},${y + height}
|
||||
${x + 5 * height},${y}
|
||||
${x},${y - 7 * height}
|
||||
${x - 5 * height},${y}
|
||||
${x - 3.5 * height},${y + height}
|
||||
`}
|
||||
stroke={colour}
|
||||
stroke-width="2"
|
||||
id="charge"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user