Socket
Socket
Sign inDemoInstall

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.0-beta.5 to 2.0.0

4

package.json
{
"name": "tsparticles-move-base",
"version": "2.0.0-beta.5",
"version": "2.0.0",
"description": "tsParticles Base movement",

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

"dependencies": {
"tsparticles-engine": "^2.0.0-beta.4"
"tsparticles-engine": "^2.0.0"
}
}

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

* How to use? : Check the GitHub README
* v2.0.0-beta.5
* v2.0.0
*/

@@ -10,0 +10,0 @@ (function webpackUniversalModuleDefinition(root, factory) {

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

/*! tsParticles Base Move v2.0.0-beta.5 by Matteo Bruni */
/*! tsParticles Base Move v2.0.0 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=l.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&&x.maxSpeed>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}()}));

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