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.
package/tsparticles.js CHANGED
@@ -1222,14 +1222,11 @@
1222
1222
  };
1223
1223
  }
1224
1224
  function circleBounce(p1, p2) {
1225
- const xVelocityDiff = p1.velocity.x;
1226
- const yVelocityDiff = p1.velocity.y;
1227
- const pos1 = p1.position;
1228
- const pos2 = p2.position;
1229
- const xDist = pos2.x - pos1.x;
1230
- const yDist = pos2.y - pos1.y;
1225
+ const {x: xVelocityDiff, y: yVelocityDiff} = p1.velocity.sub(p2.velocity);
1226
+ const [pos1, pos2] = [ p1.position, p2.position ];
1227
+ const {dx: xDist, dy: yDist} = getDistances(pos2, pos1);
1231
1228
  if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
1232
- const angle = -Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x);
1229
+ const angle = -Math.atan2(yDist, xDist);
1233
1230
  const m1 = p1.mass;
1234
1231
  const m2 = p2.mass;
1235
1232
  const u1 = p1.velocity.rotate(angle);