Several positive and negative monopoles are scattered around the canvas then the particles are allowed to travel along the field lines.
In this piece I implemented a monopole simulation.
The project is written in vanilla Javascript.
The drawing is executed in a square at window resolution.
Press '2' to double the resolution. You can press again '2' to double once more; Press '1' to get back at the window size. Press 's' to save a png at the current resolution. You can also right click and 'save-as' to obtain the same result.
It uses two external packages, both licensed under MIT license: * https://www.npmjs.com/package/file-saver * https://www.npmjs.com/package/alea