tsparticles 1.37.4 → 1.37.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -939,14 +939,11 @@
939
939
  };
940
940
  }
941
941
  function circleBounce(p1, p2) {
942
- const xVelocityDiff = p1.velocity.x;
943
- const yVelocityDiff = p1.velocity.y;
944
- const pos1 = p1.position;
945
- const pos2 = p2.position;
946
- const xDist = pos2.x - pos1.x;
947
- const yDist = pos2.y - pos1.y;
942
+ const {x: xVelocityDiff, y: yVelocityDiff} = p1.velocity.sub(p2.velocity);
943
+ const [pos1, pos2] = [ p1.position, p2.position ];
944
+ const {dx: xDist, dy: yDist} = getDistances(pos2, pos1);
948
945
  if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
949
- const angle = -Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x);
946
+ const angle = -Math.atan2(yDist, xDist);
950
947
  const m1 = p1.mass;
951
948
  const m2 = p2.mass;
952
949
  const u1 = p1.velocity.rotate(angle);