@tsparticles/move-base 3.7.0 → 3.8.0
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/browser/Utils.js +5 -6
- package/browser/index.js +1 -2
- package/cjs/Utils.js +5 -6
- package/cjs/index.js +1 -2
- package/esm/Utils.js +5 -6
- package/esm/index.js +1 -2
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.move.base.js +3 -3
- package/tsparticles.move.base.min.js +1 -1
- package/tsparticles.move.base.min.js.LICENSE.txt +1 -1
- package/umd/Utils.js +5 -6
- package/umd/index.js +2 -3
package/browser/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RotateDirection, clamp, getDistance, getDistances, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
-
const half = 0.5, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01;
|
|
2
|
+
const half = 0.5, double = 2, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, doublePI = Math.PI * double;
|
|
3
3
|
export function applyDistance(particle) {
|
|
4
4
|
const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|
|
5
5
|
if (!hDistance && !vDistance) {
|
|
@@ -66,9 +66,9 @@ export function spin(particle, moveSpeed) {
|
|
|
66
66
|
if (!particle.spin) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const updateFunc = {
|
|
70
|
-
x:
|
|
71
|
-
y:
|
|
69
|
+
const spinClockwise = particle.spin.direction === RotateDirection.clockwise, updateFunc = {
|
|
70
|
+
x: spinClockwise ? Math.cos : Math.sin,
|
|
71
|
+
y: spinClockwise ? Math.sin : Math.cos,
|
|
72
72
|
};
|
|
73
73
|
particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
|
|
74
74
|
particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
|
|
@@ -116,11 +116,10 @@ export function initSpin(particle) {
|
|
|
116
116
|
y: spinPos.y * spinFactor * container.canvas.size.height,
|
|
117
117
|
}, pos = particle.getPosition(), distance = getDistance(pos, spinCenter), spinAcceleration = getRangeValue(spinOptions.acceleration);
|
|
118
118
|
particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;
|
|
119
|
-
const minVelocity = 0;
|
|
120
119
|
particle.spin = {
|
|
121
120
|
center: spinCenter,
|
|
122
121
|
direction: particle.velocity.x >= minVelocity ? RotateDirection.clockwise : RotateDirection.counterClockwise,
|
|
123
|
-
angle:
|
|
122
|
+
angle: getRandom() * doublePI,
|
|
124
123
|
radius: distance,
|
|
125
124
|
acceleration: particle.retina.spinAcceleration,
|
|
126
125
|
};
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { assertValidVersion } from "@tsparticles/engine";
|
|
2
1
|
import { BaseMover } from "./BaseMover.js";
|
|
3
2
|
export async function loadBaseMover(engine, refresh = true) {
|
|
4
|
-
|
|
3
|
+
engine.checkVersion("3.8.0");
|
|
5
4
|
await engine.addMover("base", () => {
|
|
6
5
|
return Promise.resolve(new BaseMover());
|
|
7
6
|
}, refresh);
|
package/cjs/Utils.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.applyPath = applyPath;
|
|
|
7
7
|
exports.getProximitySpeedFactor = getProximitySpeedFactor;
|
|
8
8
|
exports.initSpin = initSpin;
|
|
9
9
|
const engine_1 = require("@tsparticles/engine");
|
|
10
|
-
const half = 0.5, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01;
|
|
10
|
+
const half = 0.5, double = 2, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, doublePI = Math.PI * double;
|
|
11
11
|
function applyDistance(particle) {
|
|
12
12
|
const initialPosition = particle.initialPosition, { dx, dy } = (0, engine_1.getDistances)(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|
|
13
13
|
if (!hDistance && !vDistance) {
|
|
@@ -74,9 +74,9 @@ function spin(particle, moveSpeed) {
|
|
|
74
74
|
if (!particle.spin) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const updateFunc = {
|
|
78
|
-
x:
|
|
79
|
-
y:
|
|
77
|
+
const spinClockwise = particle.spin.direction === engine_1.RotateDirection.clockwise, updateFunc = {
|
|
78
|
+
x: spinClockwise ? Math.cos : Math.sin,
|
|
79
|
+
y: spinClockwise ? Math.sin : Math.cos,
|
|
80
80
|
};
|
|
81
81
|
particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
|
|
82
82
|
particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
|
|
@@ -124,11 +124,10 @@ function initSpin(particle) {
|
|
|
124
124
|
y: spinPos.y * spinFactor * container.canvas.size.height,
|
|
125
125
|
}, pos = particle.getPosition(), distance = (0, engine_1.getDistance)(pos, spinCenter), spinAcceleration = (0, engine_1.getRangeValue)(spinOptions.acceleration);
|
|
126
126
|
particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;
|
|
127
|
-
const minVelocity = 0;
|
|
128
127
|
particle.spin = {
|
|
129
128
|
center: spinCenter,
|
|
130
129
|
direction: particle.velocity.x >= minVelocity ? engine_1.RotateDirection.clockwise : engine_1.RotateDirection.counterClockwise,
|
|
131
|
-
angle:
|
|
130
|
+
angle: (0, engine_1.getRandom)() * doublePI,
|
|
132
131
|
radius: distance,
|
|
133
132
|
acceleration: particle.retina.spinAcceleration,
|
|
134
133
|
};
|
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadBaseMover = loadBaseMover;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
4
|
const BaseMover_js_1 = require("./BaseMover.js");
|
|
6
5
|
async function loadBaseMover(engine, refresh = true) {
|
|
7
|
-
|
|
6
|
+
engine.checkVersion("3.8.0");
|
|
8
7
|
await engine.addMover("base", () => {
|
|
9
8
|
return Promise.resolve(new BaseMover_js_1.BaseMover());
|
|
10
9
|
}, refresh);
|
package/esm/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RotateDirection, clamp, getDistance, getDistances, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
-
const half = 0.5, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01;
|
|
2
|
+
const half = 0.5, double = 2, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, doublePI = Math.PI * double;
|
|
3
3
|
export function applyDistance(particle) {
|
|
4
4
|
const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|
|
5
5
|
if (!hDistance && !vDistance) {
|
|
@@ -66,9 +66,9 @@ export function spin(particle, moveSpeed) {
|
|
|
66
66
|
if (!particle.spin) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const updateFunc = {
|
|
70
|
-
x:
|
|
71
|
-
y:
|
|
69
|
+
const spinClockwise = particle.spin.direction === RotateDirection.clockwise, updateFunc = {
|
|
70
|
+
x: spinClockwise ? Math.cos : Math.sin,
|
|
71
|
+
y: spinClockwise ? Math.sin : Math.cos,
|
|
72
72
|
};
|
|
73
73
|
particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
|
|
74
74
|
particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
|
|
@@ -116,11 +116,10 @@ export function initSpin(particle) {
|
|
|
116
116
|
y: spinPos.y * spinFactor * container.canvas.size.height,
|
|
117
117
|
}, pos = particle.getPosition(), distance = getDistance(pos, spinCenter), spinAcceleration = getRangeValue(spinOptions.acceleration);
|
|
118
118
|
particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;
|
|
119
|
-
const minVelocity = 0;
|
|
120
119
|
particle.spin = {
|
|
121
120
|
center: spinCenter,
|
|
122
121
|
direction: particle.velocity.x >= minVelocity ? RotateDirection.clockwise : RotateDirection.counterClockwise,
|
|
123
|
-
angle:
|
|
122
|
+
angle: getRandom() * doublePI,
|
|
124
123
|
radius: distance,
|
|
125
124
|
acceleration: particle.retina.spinAcceleration,
|
|
126
125
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { assertValidVersion } from "@tsparticles/engine";
|
|
2
1
|
import { BaseMover } from "./BaseMover.js";
|
|
3
2
|
export async function loadBaseMover(engine, refresh = true) {
|
|
4
|
-
|
|
3
|
+
engine.checkVersion("3.8.0");
|
|
5
4
|
await engine.addMover("base", () => {
|
|
6
5
|
return Promise.resolve(new BaseMover());
|
|
7
6
|
}, refresh);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/move-base",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "tsParticles Base movement",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "3.
|
|
90
|
+
"@tsparticles/engine": "3.8.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/move-base [
|
|
6
|
+
<title>@tsparticles/move-base [23 Jan 2025 at 08:57]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
package/tsparticles.move.base.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.
|
|
7
|
+
* v3.8.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -44,7 +44,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
44
44
|
\*******************************/
|
|
45
45
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
46
|
|
|
47
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ applyDistance: () => (/* binding */ applyDistance),\n/* harmony export */ applyPath: () => (/* binding */ applyPath),\n/* harmony export */ getProximitySpeedFactor: () => (/* binding */ getProximitySpeedFactor),\n/* harmony export */ initSpin: () => (/* binding */ initSpin),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ spin: () => (/* binding */ spin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst half = 0.5,\n minVelocity = 0,\n identity = 1,\n moveSpeedFactor = 60,\n minSpinRadius = 0,\n spinFactor = 0.01;\nfunction applyDistance(particle) {\n const initialPosition = particle.initialPosition,\n {\n dx,\n dy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(initialPosition, particle.position),\n dxFixed = Math.abs(dx),\n dyFixed = Math.abs(dy),\n {\n maxDistance\n } = particle.retina,\n hDistance = maxDistance.horizontal,\n vDistance = maxDistance.vertical;\n if (!hDistance && !vDistance) {\n return;\n }\n const hasHDistance = (hDistance && dxFixed >= hDistance) ?? false,\n hasVDistance = (vDistance && dyFixed >= vDistance) ?? false;\n if ((hasHDistance || hasVDistance) && !particle.misplaced) {\n particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;\n if (hDistance) {\n particle.velocity.x = particle.velocity.y * half - particle.velocity.x;\n }\n if (vDistance) {\n particle.velocity.y = particle.velocity.x * half - particle.velocity.y;\n }\n } else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {\n particle.misplaced = false;\n } else if (particle.misplaced) {\n const pos = particle.position,\n vel = particle.velocity;\n if (hDistance && (pos.x < initialPosition.x && vel.x < minVelocity || pos.x > initialPosition.x && vel.x > minVelocity)) {\n vel.x *= -(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n if (vDistance && (pos.y < initialPosition.y && vel.y < minVelocity || pos.y > initialPosition.y && vel.y > minVelocity)) {\n vel.y *= -(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n}\nfunction move(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta) {\n applyPath(particle, delta);\n const gravityOptions = particle.gravity,\n gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity : identity;\n if (moveDrift && moveSpeed) {\n particle.velocity.x += moveDrift * delta.factor / (moveSpeedFactor * moveSpeed);\n }\n if (gravityOptions?.enable && moveSpeed) {\n particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (moveSpeedFactor * moveSpeed);\n }\n const decay = particle.moveDecay;\n particle.velocity.multTo(decay);\n const velocity = particle.velocity.mult(moveSpeed);\n if (gravityOptions?.enable && maxSpeed > minVelocity && (!gravityOptions.inverse && velocity.y >= minVelocity && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= minVelocity && velocity.y <= -maxSpeed)) {\n velocity.y = gravityFactor * maxSpeed;\n if (moveSpeed) {\n particle.velocity.y = velocity.y / moveSpeed;\n }\n }\n const zIndexOptions = particle.options.zIndex,\n zVelocityFactor = (identity - particle.zIndexFactor) ** zIndexOptions.velocityRate;\n velocity.multTo(zVelocityFactor);\n const {\n position\n } = particle;\n position.addTo(velocity);\n if (moveOptions.vibrate) {\n position.x += Math.sin(position.x * Math.cos(position.y));\n position.y += Math.cos(position.y * Math.sin(position.x));\n }\n}\nfunction spin(particle, moveSpeed) {\n const container = particle.container;\n if (!particle.spin) {\n return;\n }\n const
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ applyDistance: () => (/* binding */ applyDistance),\n/* harmony export */ applyPath: () => (/* binding */ applyPath),\n/* harmony export */ getProximitySpeedFactor: () => (/* binding */ getProximitySpeedFactor),\n/* harmony export */ initSpin: () => (/* binding */ initSpin),\n/* harmony export */ move: () => (/* binding */ move),\n/* harmony export */ spin: () => (/* binding */ spin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst half = 0.5,\n double = 2,\n minVelocity = 0,\n identity = 1,\n moveSpeedFactor = 60,\n minSpinRadius = 0,\n spinFactor = 0.01,\n doublePI = Math.PI * double;\nfunction applyDistance(particle) {\n const initialPosition = particle.initialPosition,\n {\n dx,\n dy\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(initialPosition, particle.position),\n dxFixed = Math.abs(dx),\n dyFixed = Math.abs(dy),\n {\n maxDistance\n } = particle.retina,\n hDistance = maxDistance.horizontal,\n vDistance = maxDistance.vertical;\n if (!hDistance && !vDistance) {\n return;\n }\n const hasHDistance = (hDistance && dxFixed >= hDistance) ?? false,\n hasVDistance = (vDistance && dyFixed >= vDistance) ?? false;\n if ((hasHDistance || hasVDistance) && !particle.misplaced) {\n particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;\n if (hDistance) {\n particle.velocity.x = particle.velocity.y * half - particle.velocity.x;\n }\n if (vDistance) {\n particle.velocity.y = particle.velocity.x * half - particle.velocity.y;\n }\n } else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {\n particle.misplaced = false;\n } else if (particle.misplaced) {\n const pos = particle.position,\n vel = particle.velocity;\n if (hDistance && (pos.x < initialPosition.x && vel.x < minVelocity || pos.x > initialPosition.x && vel.x > minVelocity)) {\n vel.x *= -(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n if (vDistance && (pos.y < initialPosition.y && vel.y < minVelocity || pos.y > initialPosition.y && vel.y > minVelocity)) {\n vel.y *= -(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n}\nfunction move(particle, moveOptions, moveSpeed, maxSpeed, moveDrift, delta) {\n applyPath(particle, delta);\n const gravityOptions = particle.gravity,\n gravityFactor = gravityOptions?.enable && gravityOptions.inverse ? -identity : identity;\n if (moveDrift && moveSpeed) {\n particle.velocity.x += moveDrift * delta.factor / (moveSpeedFactor * moveSpeed);\n }\n if (gravityOptions?.enable && moveSpeed) {\n particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (moveSpeedFactor * moveSpeed);\n }\n const decay = particle.moveDecay;\n particle.velocity.multTo(decay);\n const velocity = particle.velocity.mult(moveSpeed);\n if (gravityOptions?.enable && maxSpeed > minVelocity && (!gravityOptions.inverse && velocity.y >= minVelocity && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= minVelocity && velocity.y <= -maxSpeed)) {\n velocity.y = gravityFactor * maxSpeed;\n if (moveSpeed) {\n particle.velocity.y = velocity.y / moveSpeed;\n }\n }\n const zIndexOptions = particle.options.zIndex,\n zVelocityFactor = (identity - particle.zIndexFactor) ** zIndexOptions.velocityRate;\n velocity.multTo(zVelocityFactor);\n const {\n position\n } = particle;\n position.addTo(velocity);\n if (moveOptions.vibrate) {\n position.x += Math.sin(position.x * Math.cos(position.y));\n position.y += Math.cos(position.y * Math.sin(position.x));\n }\n}\nfunction spin(particle, moveSpeed) {\n const container = particle.container;\n if (!particle.spin) {\n return;\n }\n const spinClockwise = particle.spin.direction === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise,\n updateFunc = {\n x: spinClockwise ? Math.cos : Math.sin,\n y: spinClockwise ? Math.sin : Math.cos\n };\n particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);\n particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);\n particle.spin.radius += particle.spin.acceleration;\n const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height),\n halfMaxSize = maxCanvasSize * half;\n if (particle.spin.radius > halfMaxSize) {\n particle.spin.radius = halfMaxSize;\n particle.spin.acceleration *= -identity;\n } else if (particle.spin.radius < minSpinRadius) {\n particle.spin.radius = minSpinRadius;\n particle.spin.acceleration *= -identity;\n }\n particle.spin.angle += moveSpeed * spinFactor * (identity - particle.spin.radius / maxCanvasSize);\n}\nfunction applyPath(particle, delta) {\n const particlesOptions = particle.options,\n pathOptions = particlesOptions.move.path,\n pathEnabled = pathOptions.enable;\n if (!pathEnabled) {\n return;\n }\n if (particle.lastPathTime <= particle.pathDelay) {\n particle.lastPathTime += delta.value;\n return;\n }\n const path = particle.pathGenerator?.generate(particle, delta);\n if (path) {\n particle.velocity.addTo(path);\n }\n if (pathOptions.clamp) {\n particle.velocity.x = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(particle.velocity.x, -identity, identity);\n particle.velocity.y = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(particle.velocity.y, -identity, identity);\n }\n particle.lastPathTime -= particle.pathDelay;\n}\nfunction getProximitySpeedFactor(particle) {\n return particle.slow.inRange ? particle.slow.factor : identity;\n}\nfunction initSpin(particle) {\n const container = particle.container,\n options = particle.options,\n spinOptions = options.move.spin;\n if (!spinOptions.enable) {\n return;\n }\n const spinPos = spinOptions.position ?? {\n x: 50,\n y: 50\n },\n spinFactor = 0.01,\n spinCenter = {\n x: spinPos.x * spinFactor * container.canvas.size.width,\n y: spinPos.y * spinFactor * container.canvas.size.height\n },\n pos = particle.getPosition(),\n distance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, spinCenter),\n spinAcceleration = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(spinOptions.acceleration);\n particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;\n particle.spin = {\n center: spinCenter,\n direction: particle.velocity.x >= minVelocity ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise,\n angle: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * doublePI,\n radius: distance,\n acceleration: particle.retina.spinAcceleration\n };\n}\n\n//# sourceURL=webpack://@tsparticles/move-base/./dist/browser/Utils.js?");
|
|
48
48
|
|
|
49
49
|
/***/ }),
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
54
54
|
\*******************************/
|
|
55
55
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
56
56
|
|
|
57
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadBaseMover: () => (/* binding */ loadBaseMover)\n/* harmony export */ });\n/* harmony import */ var
|
|
57
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadBaseMover: () => (/* binding */ loadBaseMover)\n/* harmony export */ });\n/* harmony import */ var _BaseMover_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseMover.js */ \"./dist/browser/BaseMover.js\");\n\nasync function loadBaseMover(engine, refresh = true) {\n engine.checkVersion(\"3.8.0\");\n await engine.addMover(\"base\", () => {\n return Promise.resolve(new _BaseMover_js__WEBPACK_IMPORTED_MODULE_0__.BaseMover());\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/move-base/./dist/browser/index.js?");
|
|
58
58
|
|
|
59
59
|
/***/ }),
|
|
60
60
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.move.base.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},i={};function n(e){var o=i[e];if(void 0!==o)return o.exports;var a=i[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{loadBaseMover:()=>
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},i={};function n(e){var o=i[e];if(void 0!==o)return o.exports;var a=i[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{loadBaseMover:()=>p});var a=n(303);const s=1,r=2*Math.PI;function c(e,t,i,n,o,r){!function(e,t){const i=e.options,n=i.move.path;if(!n.enable)return;if(e.lastPathTime<=e.pathDelay)return void(e.lastPathTime+=t.value);const o=e.pathGenerator?.generate(e,t);o&&e.velocity.addTo(o);n.clamp&&(e.velocity.x=(0,a.clamp)(e.velocity.x,-s,s),e.velocity.y=(0,a.clamp)(e.velocity.y,-s,s));e.lastPathTime-=e.pathDelay}(e,r);const c=e.gravity,l=c?.enable&&c.inverse?-s:s;o&&i&&(e.velocity.x+=o*r.factor/(60*i)),c?.enable&&i&&(e.velocity.y+=l*(c.acceleration*r.factor)/(60*i));const p=e.moveDecay;e.velocity.multTo(p);const y=e.velocity.mult(i);c?.enable&&n>0&&(!c.inverse&&y.y>=0&&y.y>=n||c.inverse&&y.y<=0&&y.y<=-n)&&(y.y=l*n,i&&(e.velocity.y=y.y/i));const v=e.options.zIndex,d=(s-e.zIndexFactor)**v.velocityRate;y.multTo(d);const{position:u}=e;u.addTo(y),t.vibrate&&(u.x+=Math.sin(u.x*Math.cos(u.y)),u.y+=Math.cos(u.y*Math.sin(u.x)))}class l{init(e){const t=e.options.move.gravity;e.gravity={enable:t.enable,acceleration:(0,a.getRangeValue)(t.acceleration),inverse:t.inverse},function(e){const t=e.container,i=e.options.move.spin;if(!i.enable)return;const n=i.position??{x:50,y:50},o={x:.01*n.x*t.canvas.size.width,y:.01*n.y*t.canvas.size.height},s=e.getPosition(),c=(0,a.getDistance)(s,o),l=(0,a.getRangeValue)(i.acceleration);e.retina.spinAcceleration=l*t.retina.pixelRatio,e.spin={center:o,direction:e.velocity.x>=0?a.RotateDirection.clockwise:a.RotateDirection.counterClockwise,angle:(0,a.getRandom)()*r,radius:c,acceleration:e.retina.spinAcceleration}}(e)}isEnabled(e){return!e.destroyed&&e.options.move.enable}move(e,t){const i=e.options,n=i.move;if(!n.enable)return;const o=e.container,r=o.retina.pixelRatio;e.retina.moveSpeed??=(0,a.getRangeValue)(n.speed)*r,e.retina.moveDrift??=(0,a.getRangeValue)(e.options.move.drift)*r;const l=function(e){return e.slow.inRange?e.slow.factor:s}(e),p=e.retina.moveSpeed*o.retina.reduceFactor,y=e.retina.moveDrift,v=(0,a.getRangeMax)(i.size.value)*r,d=p*(n.size?e.getRadius()/v:1)*l*(t.factor||1)/2,u=e.retina.maxSpeed??o.retina.maxSpeed;n.spin.enable?function(e,t){const i=e.container;if(!e.spin)return;const n=e.spin.direction===a.RotateDirection.clockwise,o={x:n?Math.cos:Math.sin,y:n?Math.sin:Math.cos};e.position.x=e.spin.center.x+e.spin.radius*o.x(e.spin.angle),e.position.y=e.spin.center.y+e.spin.radius*o.y(e.spin.angle),e.spin.radius+=e.spin.acceleration;const r=Math.max(i.canvas.size.width,i.canvas.size.height),c=.5*r;e.spin.radius>c?(e.spin.radius=c,e.spin.acceleration*=-s):e.spin.radius<0&&(e.spin.radius=0,e.spin.acceleration*=-s),e.spin.angle+=.01*t*(s-e.spin.radius/r)}(e,d):c(e,n,d,u,y,t),function(e){const t=e.initialPosition,{dx:i,dy:n}=(0,a.getDistances)(t,e.position),o=Math.abs(i),s=Math.abs(n),{maxDistance:r}=e.retina,c=r.horizontal,l=r.vertical;if(!c&&!l)return;if((c&&o>=c||l&&s>=l)&&!e.misplaced)e.misplaced=!!c&&o>c||!!l&&s>l,c&&(e.velocity.x=.5*e.velocity.y-e.velocity.x),l&&(e.velocity.y=.5*e.velocity.x-e.velocity.y);else if((!c||o<c)&&(!l||s<l)&&e.misplaced)e.misplaced=!1;else if(e.misplaced){const i=e.position,n=e.velocity;c&&(i.x<t.x&&n.x<0||i.x>t.x&&n.x>0)&&(n.x*=-(0,a.getRandom)()),l&&(i.y<t.y&&n.y<0||i.y>t.y&&n.y>0)&&(n.y*=-(0,a.getRandom)())}}(e)}}async function p(e,t=!0){e.checkVersion("3.8.0"),await e.addMover("base",(()=>Promise.resolve(new l)),t)}return o})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Base Move v3.
|
|
1
|
+
/*! tsParticles Base Move v3.8.0 by Matteo Bruni */
|
package/umd/Utils.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
exports.getProximitySpeedFactor = getProximitySpeedFactor;
|
|
17
17
|
exports.initSpin = initSpin;
|
|
18
18
|
const engine_1 = require("@tsparticles/engine");
|
|
19
|
-
const half = 0.5, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01;
|
|
19
|
+
const half = 0.5, double = 2, minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, doublePI = Math.PI * double;
|
|
20
20
|
function applyDistance(particle) {
|
|
21
21
|
const initialPosition = particle.initialPosition, { dx, dy } = (0, engine_1.getDistances)(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;
|
|
22
22
|
if (!hDistance && !vDistance) {
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
if (!particle.spin) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
const updateFunc = {
|
|
87
|
-
x:
|
|
88
|
-
y:
|
|
86
|
+
const spinClockwise = particle.spin.direction === engine_1.RotateDirection.clockwise, updateFunc = {
|
|
87
|
+
x: spinClockwise ? Math.cos : Math.sin,
|
|
88
|
+
y: spinClockwise ? Math.sin : Math.cos,
|
|
89
89
|
};
|
|
90
90
|
particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
|
|
91
91
|
particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
|
|
@@ -133,11 +133,10 @@
|
|
|
133
133
|
y: spinPos.y * spinFactor * container.canvas.size.height,
|
|
134
134
|
}, pos = particle.getPosition(), distance = (0, engine_1.getDistance)(pos, spinCenter), spinAcceleration = (0, engine_1.getRangeValue)(spinOptions.acceleration);
|
|
135
135
|
particle.retina.spinAcceleration = spinAcceleration * container.retina.pixelRatio;
|
|
136
|
-
const minVelocity = 0;
|
|
137
136
|
particle.spin = {
|
|
138
137
|
center: spinCenter,
|
|
139
138
|
direction: particle.velocity.x >= minVelocity ? engine_1.RotateDirection.clockwise : engine_1.RotateDirection.counterClockwise,
|
|
140
|
-
angle:
|
|
139
|
+
angle: (0, engine_1.getRandom)() * doublePI,
|
|
141
140
|
radius: distance,
|
|
142
141
|
acceleration: particle.retina.spinAcceleration,
|
|
143
142
|
};
|
package/umd/index.js
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "
|
|
7
|
+
define(["require", "exports", "./BaseMover.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadBaseMover = loadBaseMover;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
13
|
const BaseMover_js_1 = require("./BaseMover.js");
|
|
15
14
|
async function loadBaseMover(engine, refresh = true) {
|
|
16
|
-
|
|
15
|
+
engine.checkVersion("3.8.0");
|
|
17
16
|
await engine.addMover("base", () => {
|
|
18
17
|
return Promise.resolve(new BaseMover_js_1.BaseMover());
|
|
19
18
|
}, refresh);
|