Simulation of accretion of particles attracted by electrostatic or gravitational forces, analogous to the interaction within dust clouds found in the early stages of star formation.
Uses D3's force plugin forceMagnetic to simulate the attraction/repulsion of objects of varying mass in an inverse-square relationship with distance. Further, particles are prevented from overlapping by applying a non-elastic collision force using forceBounce.
Using the slider controls you can add/remove particles to the system, and regulate the ratio of attractive (green attracts all other) vs repellent (red repels all other).
forked from vasturiano's block: Accretion
https://cdnjs.cloudflare.com/ajax/libs/d3/4.8.0/d3.min.js
https://unpkg.com/d3-force-bounce@0.4/dist/d3-force-bounce.min.js
https://unpkg.com/d3-force-surface@0.4/dist/d3-force-surface.min.js
https://unpkg.com/d3-force-magnetic@0.5/dist/d3-force-magnetic.min.js