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/Utils/Utils.js +4 -7
- package/browser/Utils/Utils.js +5 -8
- package/esm/Utils/Utils.js +5 -8
- package/package.json +1 -1
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/tsparticles.js +4 -7
- package/tsparticles.min.js +2 -2
- package/tsparticles.slim.js +4 -7
- package/tsparticles.slim.min.js +2 -2
package/Utils/Utils.js
CHANGED
|
@@ -200,14 +200,11 @@ function circleBounceDataFromParticle(p) {
|
|
|
200
200
|
}
|
|
201
201
|
exports.circleBounceDataFromParticle = circleBounceDataFromParticle;
|
|
202
202
|
function circleBounce(p1, p2) {
|
|
203
|
-
const xVelocityDiff = p1.velocity.
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const pos2 = p2.position;
|
|
207
|
-
const xDist = pos2.x - pos1.x;
|
|
208
|
-
const yDist = pos2.y - pos1.y;
|
|
203
|
+
const { x: xVelocityDiff, y: yVelocityDiff } = p1.velocity.sub(p2.velocity);
|
|
204
|
+
const [pos1, pos2] = [p1.position, p2.position];
|
|
205
|
+
const { dx: xDist, dy: yDist } = (0, NumberUtils_1.getDistances)(pos2, pos1);
|
|
209
206
|
if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
|
|
210
|
-
const angle = -Math.atan2(
|
|
207
|
+
const angle = -Math.atan2(yDist, xDist);
|
|
211
208
|
const m1 = p1.mass;
|
|
212
209
|
const m2 = p2.mass;
|
|
213
210
|
const u1 = p1.velocity.rotate(angle);
|
package/browser/Utils/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OutModeDirection } from "../Enums";
|
|
2
|
-
import { collisionVelocity, getValue } from "./NumberUtils";
|
|
2
|
+
import { collisionVelocity, getValue, getDistances } from "./NumberUtils";
|
|
3
3
|
import { Vector } from "../Core/Particle/Vector";
|
|
4
4
|
function rectSideBounce(pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor) {
|
|
5
5
|
const res = { bounced: false };
|
|
@@ -188,16 +188,13 @@ export function circleBounceDataFromParticle(p) {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
export function circleBounce(p1, p2) {
|
|
191
|
-
const xVelocityDiff = p1.velocity.
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const pos2 = p2.position;
|
|
195
|
-
const xDist = pos2.x - pos1.x;
|
|
196
|
-
const yDist = pos2.y - pos1.y;
|
|
191
|
+
const { x: xVelocityDiff, y: yVelocityDiff } = p1.velocity.sub(p2.velocity);
|
|
192
|
+
const [pos1, pos2] = [p1.position, p2.position];
|
|
193
|
+
const { dx: xDist, dy: yDist } = getDistances(pos2, pos1);
|
|
197
194
|
// Prevent accidental overlap of particles
|
|
198
195
|
if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
|
|
199
196
|
// Grab angle between the two colliding particles
|
|
200
|
-
const angle = -Math.atan2(
|
|
197
|
+
const angle = -Math.atan2(yDist, xDist);
|
|
201
198
|
// Store mass in var for better readability in collision equation
|
|
202
199
|
const m1 = p1.mass;
|
|
203
200
|
const m2 = p2.mass;
|
package/esm/Utils/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OutModeDirection } from "../Enums";
|
|
2
|
-
import { collisionVelocity, getValue } from "./NumberUtils";
|
|
2
|
+
import { collisionVelocity, getValue, getDistances } from "./NumberUtils";
|
|
3
3
|
import { Vector } from "../Core/Particle/Vector";
|
|
4
4
|
function rectSideBounce(pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor) {
|
|
5
5
|
const res = { bounced: false };
|
|
@@ -181,14 +181,11 @@ export function circleBounceDataFromParticle(p) {
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
export function circleBounce(p1, p2) {
|
|
184
|
-
const xVelocityDiff = p1.velocity.
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
const pos2 = p2.position;
|
|
188
|
-
const xDist = pos2.x - pos1.x;
|
|
189
|
-
const yDist = pos2.y - pos1.y;
|
|
184
|
+
const { x: xVelocityDiff, y: yVelocityDiff } = p1.velocity.sub(p2.velocity);
|
|
185
|
+
const [pos1, pos2] = [p1.position, p2.position];
|
|
186
|
+
const { dx: xDist, dy: yDist } = getDistances(pos2, pos1);
|
|
190
187
|
if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
|
|
191
|
-
const angle = -Math.atan2(
|
|
188
|
+
const angle = -Math.atan2(yDist, xDist);
|
|
192
189
|
const m1 = p1.mass;
|
|
193
190
|
const m2 = p2.mass;
|
|
194
191
|
const u1 = p1.velocity.rotate(angle);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsparticles",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.5",
|
|
4
4
|
"description": "Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
|
|
5
5
|
"homepage": "https://particles.js.org/",
|
|
6
6
|
"scripts": {
|