tsparticles-updater-wobble
Advanced tools
Comparing version 2.10.1 to 2.11.0
import { WobbleUpdater } from "./WobbleUpdater"; | ||
export async function loadWobbleUpdater(engine) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container)); | ||
export async function loadWobbleUpdater(engine, refresh = true) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { setRangeValue, } from "tsparticles-engine"; | ||
import { isNumber, setRangeValue, } from "tsparticles-engine"; | ||
import { WobbleSpeed } from "./WobbleSpeed"; | ||
@@ -20,3 +20,3 @@ export class Wobble { | ||
if (data.speed !== undefined) { | ||
if (typeof data.speed === "number") { | ||
if (isNumber(data.speed)) { | ||
this.speed.load({ angle: data.speed }); | ||
@@ -23,0 +23,0 @@ } |
@@ -5,5 +5,5 @@ "use strict"; | ||
const WobbleUpdater_1 = require("./WobbleUpdater"); | ||
async function loadWobbleUpdater(engine) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container)); | ||
async function loadWobbleUpdater(engine, refresh = true) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container), refresh); | ||
} | ||
exports.loadWobbleUpdater = loadWobbleUpdater; |
@@ -23,3 +23,3 @@ "use strict"; | ||
if (data.speed !== undefined) { | ||
if (typeof data.speed === "number") { | ||
if ((0, tsparticles_engine_1.isNumber)(data.speed)) { | ||
this.speed.load({ angle: data.speed }); | ||
@@ -26,0 +26,0 @@ } |
import { WobbleUpdater } from "./WobbleUpdater"; | ||
export async function loadWobbleUpdater(engine) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container)); | ||
export async function loadWobbleUpdater(engine, refresh = true) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater(container), refresh); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { setRangeValue, } from "tsparticles-engine"; | ||
import { isNumber, setRangeValue, } from "tsparticles-engine"; | ||
import { WobbleSpeed } from "./WobbleSpeed"; | ||
@@ -20,3 +20,3 @@ export class Wobble { | ||
if (data.speed !== undefined) { | ||
if (typeof data.speed === "number") { | ||
if (isNumber(data.speed)) { | ||
this.speed.load({ angle: data.speed }); | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "tsparticles-updater-wobble", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"description": "tsParticles particles wobble updater", | ||
@@ -76,5 +76,6 @@ "homepage": "https://particles.js.org", | ||
"types": "types/index.d.ts", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"tsparticles-engine": "^2.10.1" | ||
"tsparticles-engine": "^2.11.0" | ||
} | ||
} |
@@ -28,7 +28,12 @@ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org) | ||
```javascript | ||
loadWobbleUpdater(tsParticles); | ||
(async () => { | ||
await loadWobbleUpdater(tsParticles); | ||
tsParticles.load("tsparticles", { | ||
/* options */ | ||
}); | ||
await tsParticles.load({ | ||
id: "tsparticles", | ||
options: { | ||
/* options */ | ||
}, | ||
}); | ||
})(); | ||
``` | ||
@@ -56,3 +61,5 @@ | ||
loadWobbleUpdater(tsParticles); | ||
(async () => { | ||
await loadWobbleUpdater(tsParticles); | ||
})(); | ||
``` | ||
@@ -66,3 +73,5 @@ | ||
loadWobbleUpdater(tsParticles); | ||
(async () => { | ||
await loadWobbleUpdater(tsParticles); | ||
})(); | ||
``` |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.10.1 | ||
* v2.11.0 | ||
*/ | ||
@@ -139,3 +139,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (data.speed !== undefined) { | ||
if (typeof data.speed === "number") { | ||
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isNumber)(data.speed)) { | ||
this.speed.load({ | ||
@@ -227,4 +227,4 @@ angle: data.speed | ||
async function loadWobbleUpdater(engine) { | ||
await engine.addParticleUpdater("wobble", container => new WobbleUpdater(container)); | ||
async function loadWobbleUpdater(engine, refresh = true) { | ||
await engine.addParticleUpdater("wobble", container => new WobbleUpdater(container), refresh); | ||
} | ||
@@ -231,0 +231,0 @@ })(); |
/*! 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={961: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(961);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("number"==typeof 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){await e.addParticleUpdater("wobble",(e=>new s(e)))}})(),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={961: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(961);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})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Wobble Updater v2.10.1 by Matteo Bruni */ | ||
/*! tsParticles Wobble Updater v2.11.0 by Matteo Bruni */ |
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadWobbleUpdater(engine: Engine): Promise<void>; | ||
export declare function loadWobbleUpdater(engine: Engine, refresh?: boolean): Promise<void>; |
@@ -14,6 +14,6 @@ (function (factory) { | ||
const WobbleUpdater_1 = require("./WobbleUpdater"); | ||
async function loadWobbleUpdater(engine) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container)); | ||
async function loadWobbleUpdater(engine, refresh = true) { | ||
await engine.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container), refresh); | ||
} | ||
exports.loadWobbleUpdater = loadWobbleUpdater; | ||
}); |
@@ -32,3 +32,3 @@ (function (factory) { | ||
if (data.speed !== undefined) { | ||
if (typeof data.speed === "number") { | ||
if ((0, tsparticles_engine_1.isNumber)(data.speed)) { | ||
this.speed.load({ angle: data.speed }); | ||
@@ -35,0 +35,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318404
75
Updatedtsparticles-engine@^2.11.0