Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsparticles-move-base

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsparticles-move-base - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

browser/BaseMover.js

43

package.json
{
"name": "tsparticles-move-base",
"version": "2.0.5",
"version": "2.0.6",
"description": "tsParticles Base movement",

@@ -13,2 +13,4 @@ "homepage": "https://particles.js.org/",

"tsparticles",
"particles.js",
"particlesjs",
"particles",

@@ -20,5 +22,22 @@ "particle",

"particles-js",
"particles.js",
"particles-bg",
"particles-bg-vue",
"particles-ts",
"particles.ts",
"react-particles-js",
"react-particles.js",
"react-particles",
"react",
"reactjs",
"vue-particles",
"ngx-particles",
"angular-particles",
"particleground",
"vue",
"vuejs",
"preact",
"preactjs",
"jquery",
"angularjs",
"angular",
"typescript",

@@ -36,3 +55,12 @@ "javascript",

"background",
"tsparticles-shape"
"confetti",
"canvas",
"fireworks",
"fireworks-js",
"confetti-js",
"confettijs",
"fireworksjs",
"canvas-confetti",
"tsparticles-plugin",
"tsparticles-move"
],

@@ -44,11 +72,10 @@ "author": "Matteo Bruni",

},
"main": "index.js",
"main": "cjs/index.js",
"jsdelivr": "tsparticles.move.base.min.js",
"unpkg": "tsparticles.move.base.min.js",
"browser": "index.js",
"module": "index.js",
"types": "index.d.ts",
"module": "esm/index.js",
"types": "types/index.d.ts",
"dependencies": {
"tsparticles-engine": "^2.0.5"
"tsparticles-engine": "^2.0.6"
}
}

66

tsparticles.move.base.js

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v2.0.5
* v2.0.6
*/

@@ -100,3 +100,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(818);
;// CONCATENATED MODULE: ./dist/Utils.js
;// CONCATENATED MODULE: ./dist/browser/Utils.js

@@ -151,4 +151,8 @@ function applyDistance(particle) {

const updateFunc = {
x: particle.spin.direction === "clockwise" ? Math.cos : Math.sin,
y: particle.spin.direction === "clockwise" ? Math.sin : Math.cos
x: particle.spin.direction === "clockwise"
/* clockwise */
? Math.cos : Math.sin,
y: particle.spin.direction === "clockwise"
/* clockwise */
? Math.sin : Math.cos
};

@@ -199,3 +203,5 @@ particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);

const options = container.actualOptions;
const active = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)("slow", options.interactivity.events.onHover.mode);
const active = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)("slow"
/* slow */
, options.interactivity.events.onHover.mode);

@@ -224,3 +230,3 @@ if (!active) {

}
;// CONCATENATED MODULE: ./dist/BaseMover.js
;// CONCATENATED MODULE: ./dist/browser/BaseMover.js

@@ -251,3 +257,7 @@

center: spinCenter,
direction: particle.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
direction: particle.velocity.x >= 0 ? "clockwise"
/* clockwise */
: "counter-clockwise"
/* counterClockwise */
,
angle: particle.velocity.angle,

@@ -315,3 +325,3 @@ radius: distance,

const zIndexOptions = particle.options.zIndex,
zVelocityFactor = Math.pow(1 - particle.zIndexFactor, zIndexOptions.velocityRate);
zVelocityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.velocityRate;

@@ -337,40 +347,6 @@ if (moveOptions.spin.enable) {

}
;// CONCATENATED MODULE: ./dist/index.js
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
;// CONCATENATED MODULE: ./dist/browser/index.js
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
function loadBaseMover(engine) {
return __awaiter(this, void 0, void 0, function* () {
engine.addMover("base", () => new BaseMover());
});
async function loadBaseMover(engine) {
engine.addMover("base", () => new BaseMover());
}

@@ -377,0 +353,0 @@ }();

@@ -1,2 +0,2 @@

/*! tsParticles Base Move v2.0.5 by Matteo Bruni */
!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,(function(e){return function(){"use strict";var t={818:function(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=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){n.r(o),n.d(o,{loadBaseMover:function(){return a}});var e=n(818);class t{init(t){var i;const n=t.container,o=t.options.move.spin;if(o.enable){const a=null!==(i=o.position)&&void 0!==i?i:{x:50,y:50},s={x:a.x/100*n.canvas.size.width,y:a.y/100*n.canvas.size.height},r=t.getPosition(),c=(0,e.getDistance)(r,s),l=(0,e.getRangeValue)(o.acceleration);t.retina.spinAcceleration=l*n.retina.pixelRatio,t.spin={center:s,direction:t.velocity.x>=0?"clockwise":"counter-clockwise",angle:t.velocity.angle,radius:c,acceleration:t.retina.spinAcceleration}}}isEnabled(e){return!e.destroyed&&e.options.move.enable}move(t,i){var n,o,a,s,r;const c=t.options,l=c.move;if(!l.enable)return;const p=t.container,u=function(t){const i=t.container,n=i.actualOptions;if(!(0,e.isInArray)("slow",n.interactivity.events.onHover.mode))return 1;const o=t.container.interactivity.mouse.position;if(!o)return 1;const a=t.getPosition(),s=(0,e.getDistance)(o,a),r=i.retina.slowModeRadius;return s>r?1:(s/r||0)/n.interactivity.modes.slow.factor}(t),y=(null!==(n=(s=t.retina).moveSpeed)&&void 0!==n?n:s.moveSpeed=(0,e.getRangeValue)(l.speed)*p.retina.pixelRatio)*p.retina.reduceFactor,v=null!==(o=(r=t.retina).moveDrift)&&void 0!==o?o:r.moveDrift=(0,e.getRangeValue)(t.options.move.drift)*p.retina.pixelRatio,d=(0,e.getRangeMax)(c.size.value)*p.retina.pixelRatio,f=y*((l.size?t.getRadius()/d:1)*u*(i.factor||1))/2;!function(t,i){const n=t.options.move.path;if(!n.enable)return;const o=t.container;if(t.lastPathTime<=t.pathDelay)return void(t.lastPathTime+=i.value);const a=o.pathGenerator.generate(t);t.velocity.addTo(a),n.clamp&&(t.velocity.x=(0,e.clamp)(t.velocity.x,-1,1),t.velocity.y=(0,e.clamp)(t.velocity.y,-1,1)),t.lastPathTime-=t.pathDelay}(t,i);const x=t.gravity,m=x.enable&&x.inverse?-1:1;x.enable&&f&&(t.velocity.y+=m*(x.acceleration*i.factor)/(60*f)),v&&f&&(t.velocity.x+=v*i.factor/(60*f));const h=t.moveDecay;1!=h&&t.velocity.multTo(h);const g=t.velocity.mult(f),b=null!==(a=t.retina.maxSpeed)&&void 0!==a?a:p.retina.maxSpeed;x.enable&&b>0&&(!x.inverse&&g.y>=0&&g.y>=b||x.inverse&&g.y<=0&&g.y<=-b)&&(g.y=m*b,f&&(t.velocity.y=g.y/f));const M=t.options.zIndex,w=Math.pow(1-t.zIndexFactor,M.velocityRate);l.spin.enable?function(e,t){const i=e.container;if(!e.spin)return;const n={x:"clockwise"===e.spin.direction?Math.cos:Math.sin,y:"clockwise"===e.spin.direction?Math.sin:Math.cos};e.position.x=e.spin.center.x+e.spin.radius*n.x(e.spin.angle),e.position.y=e.spin.center.y+e.spin.radius*n.y(e.spin.angle),e.spin.radius+=e.spin.acceleration;const o=Math.max(i.canvas.size.width,i.canvas.size.height);e.spin.radius>o/2?(e.spin.radius=o/2,e.spin.acceleration*=-1):e.spin.radius<0&&(e.spin.radius=0,e.spin.acceleration*=-1),e.spin.angle+=t/100*(1-e.spin.radius/o)}(t,f):(1!=w&&g.multTo(w),t.position.addTo(g),l.vibrate&&(t.position.x+=Math.sin(t.position.x*Math.cos(t.position.y)),t.position.y+=Math.cos(t.position.y*Math.sin(t.position.x)))),function(t){const i=t.initialPosition,{dx:n,dy:o}=(0,e.getDistances)(i,t.position),a=Math.abs(n),s=Math.abs(o),r=t.retina.maxDistance.horizontal,c=t.retina.maxDistance.vertical;if(r||c)if((r&&a>=r||c&&s>=c)&&!t.misplaced)t.misplaced=!!r&&a>r||!!c&&s>c,r&&(t.velocity.x=t.velocity.y/2-t.velocity.x),c&&(t.velocity.y=t.velocity.x/2-t.velocity.y);else if((!r||a<r)&&(!c||s<c)&&t.misplaced)t.misplaced=!1;else if(t.misplaced){const e=t.position,n=t.velocity;r&&(e.x<i.x&&n.x<0||e.x>i.x&&n.x>0)&&(n.x*=-Math.random()),c&&(e.y<i.y&&n.y<0||e.y>i.y&&n.y>0)&&(n.y*=-Math.random())}}(t)}}var i=function(e,t,i,n){return new(i||(i=Promise))((function(o,a){function s(e){try{c(n.next(e))}catch(e){a(e)}}function r(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,r)}c((n=n.apply(e,t||[])).next())}))};function a(e){return i(this,void 0,void 0,(function*(){e.addMover("base",(()=>new t))}))}}(),o}()}));
/*! tsParticles Base Move v2.0.6 by Matteo Bruni */
!function(e,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],i);else{var t="object"==typeof exports?i(require("tsparticles-engine")):i(e.window);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,(function(e){return function(){"use strict";var i={818:function(i){i.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var a=t[e]={exports:{}};return i[e](a,a.exports,n),a.exports}n.d=function(e,i){for(var t in i)n.o(i,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},n.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){n.r(o),n.d(o,{loadBaseMover:function(){return t}});var e=n(818);class i{init(i){var t;const n=i.container,o=i.options.move.spin;if(o.enable){const a=null!==(t=o.position)&&void 0!==t?t:{x:50,y:50},s={x:a.x/100*n.canvas.size.width,y:a.y/100*n.canvas.size.height},r=i.getPosition(),c=(0,e.getDistance)(r,s),l=(0,e.getRangeValue)(o.acceleration);i.retina.spinAcceleration=l*n.retina.pixelRatio,i.spin={center:s,direction:i.velocity.x>=0?"clockwise":"counter-clockwise",angle:i.velocity.angle,radius:c,acceleration:i.retina.spinAcceleration}}}isEnabled(e){return!e.destroyed&&e.options.move.enable}move(i,t){var n,o,a,s,r;const c=i.options,l=c.move;if(!l.enable)return;const p=i.container,y=function(i){const t=i.container,n=t.actualOptions;if(!(0,e.isInArray)("slow",n.interactivity.events.onHover.mode))return 1;const o=i.container.interactivity.mouse.position;if(!o)return 1;const a=i.getPosition(),s=(0,e.getDistance)(o,a),r=t.retina.slowModeRadius;return s>r?1:(s/r||0)/n.interactivity.modes.slow.factor}(i),d=(null!==(n=(s=i.retina).moveSpeed)&&void 0!==n?n:s.moveSpeed=(0,e.getRangeValue)(l.speed)*p.retina.pixelRatio)*p.retina.reduceFactor,u=null!==(o=(r=i.retina).moveDrift)&&void 0!==o?o:r.moveDrift=(0,e.getRangeValue)(i.options.move.drift)*p.retina.pixelRatio,v=(0,e.getRangeMax)(c.size.value)*p.retina.pixelRatio,f=d*((l.size?i.getRadius()/v:1)*y*(t.factor||1))/2;!function(i,t){const n=i.options.move.path;if(!n.enable)return;const o=i.container;if(i.lastPathTime<=i.pathDelay)return void(i.lastPathTime+=t.value);const a=o.pathGenerator.generate(i);i.velocity.addTo(a),n.clamp&&(i.velocity.x=(0,e.clamp)(i.velocity.x,-1,1),i.velocity.y=(0,e.clamp)(i.velocity.y,-1,1)),i.lastPathTime-=i.pathDelay}(i,t);const x=i.gravity,m=x.enable&&x.inverse?-1:1;x.enable&&f&&(i.velocity.y+=m*(x.acceleration*t.factor)/(60*f)),u&&f&&(i.velocity.x+=u*t.factor/(60*f));const g=i.moveDecay;1!=g&&i.velocity.multTo(g);const h=i.velocity.mult(f),b=null!==(a=i.retina.maxSpeed)&&void 0!==a?a:p.retina.maxSpeed;x.enable&&b>0&&(!x.inverse&&h.y>=0&&h.y>=b||x.inverse&&h.y<=0&&h.y<=-b)&&(h.y=m*b,f&&(i.velocity.y=h.y/f));const M=i.options.zIndex,w=(1-i.zIndexFactor)**M.velocityRate;l.spin.enable?function(e,i){const t=e.container;if(!e.spin)return;const n={x:"clockwise"===e.spin.direction?Math.cos:Math.sin,y:"clockwise"===e.spin.direction?Math.sin:Math.cos};e.position.x=e.spin.center.x+e.spin.radius*n.x(e.spin.angle),e.position.y=e.spin.center.y+e.spin.radius*n.y(e.spin.angle),e.spin.radius+=e.spin.acceleration;const o=Math.max(t.canvas.size.width,t.canvas.size.height);e.spin.radius>o/2?(e.spin.radius=o/2,e.spin.acceleration*=-1):e.spin.radius<0&&(e.spin.radius=0,e.spin.acceleration*=-1),e.spin.angle+=i/100*(1-e.spin.radius/o)}(i,f):(1!=w&&h.multTo(w),i.position.addTo(h),l.vibrate&&(i.position.x+=Math.sin(i.position.x*Math.cos(i.position.y)),i.position.y+=Math.cos(i.position.y*Math.sin(i.position.x)))),function(i){const t=i.initialPosition,{dx:n,dy:o}=(0,e.getDistances)(t,i.position),a=Math.abs(n),s=Math.abs(o),r=i.retina.maxDistance.horizontal,c=i.retina.maxDistance.vertical;if(r||c)if((r&&a>=r||c&&s>=c)&&!i.misplaced)i.misplaced=!!r&&a>r||!!c&&s>c,r&&(i.velocity.x=i.velocity.y/2-i.velocity.x),c&&(i.velocity.y=i.velocity.x/2-i.velocity.y);else if((!r||a<r)&&(!c||s<c)&&i.misplaced)i.misplaced=!1;else if(i.misplaced){const e=i.position,n=i.velocity;r&&(e.x<t.x&&n.x<0||e.x>t.x&&n.x>0)&&(n.x*=-Math.random()),c&&(e.y<t.y&&n.y<0||e.y>t.y&&n.y>0)&&(n.y*=-Math.random())}}(i)}}async function t(e){e.addMover("base",(()=>new i))}}(),o}()}));

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc