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

@tsparticles/updater-wobble

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/updater-wobble - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

5

browser/Utils.js

@@ -0,1 +1,3 @@

import { millisecondsToSeconds } from "@tsparticles/engine";
const defaultDistance = 0, double = 2, doublePI = Math.PI * double, distanceFactor = 60;
export function updateWobble(particle, delta) {

@@ -6,3 +8,4 @@ const { wobble: wobbleOptions } = particle.options, { wobble } = particle;

}
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor)) /
(millisecondsToSeconds / distanceFactor), max = doublePI, { position } = particle;
wobble.angle += angleSpeed;

@@ -9,0 +12,0 @@ if (wobble.angle > max) {

import { getRandom, getRangeValue, } from "@tsparticles/engine";
import { Wobble } from "./Options/Classes/Wobble.js";
import { updateWobble } from "./Utils.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;
export class WobbleUpdater {

@@ -12,5 +13,5 @@ constructor(container) {

particle.wobble = {
angle: getRandom() * Math.PI * 2,
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / 360,
moveSpeed: getRangeValue(wobbleOpt.speed.move) / 10,
angle: getRandom() * doublePI,
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: getRangeValue(wobbleOpt.speed.move) / moveSpeedFactor,
};

@@ -25,3 +26,4 @@ }

}
particle.retina.wobbleDistance = getRangeValue(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
particle.retina.wobbleDistance =
getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
}

@@ -28,0 +30,0 @@ isEnabled(particle) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateWobble = void 0;
const engine_1 = require("@tsparticles/engine");
const defaultDistance = 0, double = 2, doublePI = Math.PI * double, distanceFactor = 60;
function updateWobble(particle, delta) {

@@ -9,3 +11,4 @@ const { wobble: wobbleOptions } = particle.options, { wobble } = particle;

}
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor)) /
(engine_1.millisecondsToSeconds / distanceFactor), max = doublePI, { position } = particle;
wobble.angle += angleSpeed;

@@ -12,0 +15,0 @@ if (wobble.angle > max) {

@@ -7,2 +7,3 @@ "use strict";

const Utils_js_1 = require("./Utils.js");
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;
class WobbleUpdater {

@@ -16,5 +17,5 @@ constructor(container) {

particle.wobble = {
angle: (0, engine_1.getRandom)() * Math.PI * 2,
angleSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.angle) / 360,
moveSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.move) / 10,
angle: (0, engine_1.getRandom)() * doublePI,
angleSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.move) / moveSpeedFactor,
};

@@ -29,3 +30,4 @@ }

}
particle.retina.wobbleDistance = (0, engine_1.getRangeValue)(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
particle.retina.wobbleDistance =
(0, engine_1.getRangeValue)(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
}

@@ -32,0 +34,0 @@ isEnabled(particle) {

@@ -0,1 +1,3 @@

import { millisecondsToSeconds } from "@tsparticles/engine";
const defaultDistance = 0, double = 2, doublePI = Math.PI * double, distanceFactor = 60;
export function updateWobble(particle, delta) {

@@ -6,3 +8,4 @@ const { wobble: wobbleOptions } = particle.options, { wobble } = particle;

}
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor)) /
(millisecondsToSeconds / distanceFactor), max = doublePI, { position } = particle;
wobble.angle += angleSpeed;

@@ -9,0 +12,0 @@ if (wobble.angle > max) {

import { getRandom, getRangeValue, } from "@tsparticles/engine";
import { Wobble } from "./Options/Classes/Wobble.js";
import { updateWobble } from "./Utils.js";
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;
export class WobbleUpdater {

@@ -12,5 +13,5 @@ constructor(container) {

particle.wobble = {
angle: getRandom() * Math.PI * 2,
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / 360,
moveSpeed: getRangeValue(wobbleOpt.speed.move) / 10,
angle: getRandom() * doublePI,
angleSpeed: getRangeValue(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: getRangeValue(wobbleOpt.speed.move) / moveSpeedFactor,
};

@@ -25,3 +26,4 @@ }

}
particle.retina.wobbleDistance = getRangeValue(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
particle.retina.wobbleDistance =
getRangeValue(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
}

@@ -28,0 +30,0 @@ isEnabled(particle) {

4

package.json
{
"name": "@tsparticles/updater-wobble",
"version": "3.0.3",
"version": "3.1.0",
"description": "tsParticles particles wobble updater",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.0.3"
"@tsparticles/engine": "^3.1.0"
},

@@ -93,0 +93,0 @@ "publishConfig": {

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

* How to use? : Check the GitHub README
* v3.0.3
* v3.1.0
*/

@@ -157,2 +157,7 @@ (function webpackUniversalModuleDefinition(root, factory) {

;// CONCATENATED MODULE: ./dist/browser/Utils.js
const defaultDistance = 0,
Utils_double = 2,
doublePI = Math.PI * Utils_double,
distanceFactor = 60;
function updateWobble(particle, delta) {

@@ -170,4 +175,4 @@ const {

moveSpeed = wobble.moveSpeed * delta.factor,
distance = moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor) / (1000 / 60),
max = 2 * Math.PI,
distance = moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor) / (engine_root_window_.millisecondsToSeconds / distanceFactor),
max = doublePI,
{

@@ -187,2 +192,7 @@ position

const WobbleUpdater_double = 2,
WobbleUpdater_doublePI = Math.PI * WobbleUpdater_double,
maxAngle = 360,
moveSpeedFactor = 10,
WobbleUpdater_defaultDistance = 0;
class WobbleUpdater {

@@ -196,5 +206,5 @@ constructor(container) {

particle.wobble = {
angle: (0,engine_root_window_.getRandom)() * Math.PI * 2,
angleSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.angle) / 360,
moveSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.move) / 10
angle: (0,engine_root_window_.getRandom)() * WobbleUpdater_doublePI,
angleSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: (0,engine_root_window_.getRangeValue)(wobbleOpt.speed.move) / moveSpeedFactor
};

@@ -208,3 +218,3 @@ } else {

}
particle.retina.wobbleDistance = (0,engine_root_window_.getRangeValue)(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
particle.retina.wobbleDistance = (0,engine_root_window_.getRangeValue)(wobbleOpt?.distance ?? WobbleUpdater_defaultDistance) * this.container.retina.pixelRatio;
}

@@ -211,0 +221,0 @@ isEnabled(particle) {

/*! For license information please see tsparticles.updater.wobble.min.js.LICENSE.txt */
!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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 a={};return(()=>{n.r(a),n.d(a,{loadWobbleUpdater:()=>i});var e=n(533);class t{constructor(){this.angle=50,this.move=10}load(t){t&&(void 0!==t.angle&&(this.angle=(0,e.setRangeValue)(t.angle)),void 0!==t.move&&(this.move=(0,e.setRangeValue)(t.move)))}}class o{constructor(){this.distance=5,this.enable=!1,this.speed=new t}load(t){if(t&&(void 0!==t.distance&&(this.distance=(0,e.setRangeValue)(t.distance)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed))if((0,e.isNumber)(t.speed))this.speed.load({angle:t.speed});else{const e=t.speed;void 0!==e.min?this.speed.load({angle:e}):this.speed.load(t.speed)}}}class s{constructor(e){this.container=e}init(t){const o=t.options.wobble;t.wobble=o?.enable?{angle:(0,e.getRandom)()*Math.PI*2,angleSpeed:(0,e.getRangeValue)(o.speed.angle)/360,moveSpeed:(0,e.getRangeValue)(o.speed.move)/10}:{angle:0,angleSpeed:0,moveSpeed:0},t.retina.wobbleDistance=(0,e.getRangeValue)(o?.distance??0)*this.container.retina.pixelRatio}isEnabled(e){return!e.destroyed&&!e.spawning&&!!e.options.wobble?.enable}loadOptions(e,...t){e.wobble||(e.wobble=new o);for(const o of t)e.wobble.load(o?.wobble)}update(e,t){this.isEnabled(e)&&function(e,t){const{wobble:o}=e.options,{wobble:n}=e;if(!o?.enable||!n)return;const a=n.angleSpeed*t.factor,s=n.moveSpeed*t.factor*((e.retina.wobbleDistance??0)*t.factor)/(1e3/60),i=2*Math.PI,{position:l}=e;n.angle+=a,n.angle>i&&(n.angle-=i),l.x+=s*Math.cos(n.angle),l.y+=s*Math.abs(Math.sin(n.angle))}(e,t)}}async function i(e,t=!0){await e.addParticleUpdater("wobble",(e=>new s(e)),t)}})(),a})()));
!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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 a={};return(()=>{n.r(a),n.d(a,{loadWobbleUpdater:()=>r});var e=n(533);class t{constructor(){this.angle=50,this.move=10}load(t){t&&(void 0!==t.angle&&(this.angle=(0,e.setRangeValue)(t.angle)),void 0!==t.move&&(this.move=(0,e.setRangeValue)(t.move)))}}class o{constructor(){this.distance=5,this.enable=!1,this.speed=new t}load(t){if(t&&(void 0!==t.distance&&(this.distance=(0,e.setRangeValue)(t.distance)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed))if((0,e.isNumber)(t.speed))this.speed.load({angle:t.speed});else{const e=t.speed;void 0!==e.min?this.speed.load({angle:e}):this.speed.load(t.speed)}}}const s=2*Math.PI;const i=2*Math.PI;class l{constructor(e){this.container=e}init(t){const o=t.options.wobble;t.wobble=o?.enable?{angle:(0,e.getRandom)()*i,angleSpeed:(0,e.getRangeValue)(o.speed.angle)/360,moveSpeed:(0,e.getRangeValue)(o.speed.move)/10}:{angle:0,angleSpeed:0,moveSpeed:0},t.retina.wobbleDistance=(0,e.getRangeValue)(o?.distance??0)*this.container.retina.pixelRatio}isEnabled(e){return!e.destroyed&&!e.spawning&&!!e.options.wobble?.enable}loadOptions(e,...t){e.wobble||(e.wobble=new o);for(const o of t)e.wobble.load(o?.wobble)}update(t,o){this.isEnabled(t)&&function(t,o){const{wobble:n}=t.options,{wobble:a}=t;if(!n?.enable||!a)return;const i=a.angleSpeed*o.factor,l=a.moveSpeed*o.factor*((t.retina.wobbleDistance??0)*o.factor)/(e.millisecondsToSeconds/60),r=s,{position:d}=t;a.angle+=i,a.angle>r&&(a.angle-=r),d.x+=l*Math.cos(a.angle),d.y+=l*Math.abs(Math.sin(a.angle))}(t,o)}}async function r(e,t=!0){await e.addParticleUpdater("wobble",(e=>new l(e)),t)}})(),a})()));

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

/*! tsParticles Wobble Updater v3.0.3 by Matteo Bruni */
/*! tsParticles Wobble Updater v3.1.0 by Matteo Bruni */

@@ -1,3 +0,3 @@

import type { IDelta } from "@tsparticles/engine";
import { type IDelta } from "@tsparticles/engine";
import type { WobbleParticle } from "./Types.js";
export declare function updateWobble(particle: WobbleParticle, delta: IDelta): void;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "@tsparticles/engine"], factory);
}

@@ -14,2 +14,4 @@ })(function (require, exports) {

exports.updateWobble = void 0;
const engine_1 = require("@tsparticles/engine");
const defaultDistance = 0, double = 2, doublePI = Math.PI * double, distanceFactor = 60;
function updateWobble(particle, delta) {

@@ -20,3 +22,4 @@ const { wobble: wobbleOptions } = particle.options, { wobble } = particle;

}
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? 0) * delta.factor)) / (1000 / 60), max = 2 * Math.PI, { position } = particle;
const angleSpeed = wobble.angleSpeed * delta.factor, moveSpeed = wobble.moveSpeed * delta.factor, distance = (moveSpeed * ((particle.retina.wobbleDistance ?? defaultDistance) * delta.factor)) /
(engine_1.millisecondsToSeconds / distanceFactor), max = doublePI, { position } = particle;
wobble.angle += angleSpeed;

@@ -23,0 +26,0 @@ if (wobble.angle > max) {

@@ -16,2 +16,3 @@ (function (factory) {

const Utils_js_1 = require("./Utils.js");
const double = 2, doublePI = Math.PI * double, maxAngle = 360, moveSpeedFactor = 10, defaultDistance = 0;
class WobbleUpdater {

@@ -25,5 +26,5 @@ constructor(container) {

particle.wobble = {
angle: (0, engine_1.getRandom)() * Math.PI * 2,
angleSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.angle) / 360,
moveSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.move) / 10,
angle: (0, engine_1.getRandom)() * doublePI,
angleSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.angle) / maxAngle,
moveSpeed: (0, engine_1.getRangeValue)(wobbleOpt.speed.move) / moveSpeedFactor,
};

@@ -38,3 +39,4 @@ }

}
particle.retina.wobbleDistance = (0, engine_1.getRangeValue)(wobbleOpt?.distance ?? 0) * this.container.retina.pixelRatio;
particle.retina.wobbleDistance =
(0, engine_1.getRangeValue)(wobbleOpt?.distance ?? defaultDistance) * this.container.retina.pixelRatio;
}

@@ -41,0 +43,0 @@ isEnabled(particle) {

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