<NME> index.js
<BEF> 
import NodeGarden from './nodegarden';

const pixelRatio = window.devicePixelRatio;
const $container = document.getElementById('container');
const $moon = document.getElementsByClassName('moon')[0];

const nodeGarden = new NodeGarden($container);

// start simulation
nodeGarden.start();

// trigger nightMode automatically
const date = new Date();

if (date.getHours() > 18 || date.getHours() < 6) {
  nodeGarden.toggleNightMode();
}

let resetNode = 0;

$container.addEventListener('click', (e) => {
  const bcr = $container.getBoundingClientRect();
  const scrollPos = {
    x: window.scrollX,
    y: window.scrollY
  };
  resetNode++;
  if (resetNode > nodeGarden.nodes.length - 1) {
    resetNode = 1;
  }
  nodeGarden.nodes[resetNode].reset({
    x: (e.pageX - scrollPos.x - bcr.left) * pixelRatio,
    y: (e.pageY - scrollPos.y - bcr.top) * pixelRatio,
    vx: 0,
    vy: 0
  });
});

$moon.addEventListener('click', () => {
  nodeGarden.toggleNightMode();
});

window.addEventListener('resize', () => {
  nodeGarden.resize();
});
      distance = Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2))

      if (distance < nodeA.m / 2 + nodeB.m / 2) {
        // collision: remove smaller or equal
        if (nodeA.m <= nodeB.m) {
          nodeA.x = Math.random() * wWidth
          nodeA.y = Math.random() * wHeight
          nodeA.vx = Math.random() * 1 - 0.5
          nodeA.vy = Math.random() * 1 - 0.5
          nodeA.m = Math.random() * 1.5 + 1
        }

        if (nodeB.m <= nodeA.m) {
          nodeB.vx = Math.random() * 1 - 0.5
          nodeB.vy = Math.random() * 1 - 0.5
          nodeB.m = Math.random() * 1.5 + 1
        }
        continue
      }

      // calculate gravity direction

<MSG> better gravity formula

<DFF> @@ -92,13 +92,14 @@ function render () {
       distance = Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2))
 
       if (distance < nodeA.m / 2 + nodeB.m / 2) {
-        // collision: remove smaller or equal
+        // collision: remove smaller or equal - never both of them
         if (nodeA.m <= nodeB.m) {
           nodeA.x = Math.random() * wWidth
           nodeA.y = Math.random() * wHeight
           nodeA.vx = Math.random() * 1 - 0.5
           nodeA.vy = Math.random() * 1 - 0.5
           nodeA.m = Math.random() * 1.5 + 1
+          continue
         }
 
         if (nodeB.m <= nodeA.m) {
@@ -107,8 +108,8 @@ function render () {
           nodeB.vx = Math.random() * 1 - 0.5
           nodeB.vy = Math.random() * 1 - 0.5
           nodeB.m = Math.random() * 1.5 + 1
+          continue
         }
-        continue
       }
 
       // calculate gravity direction

better gravity formula