New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/plugin-emitters-shape-circle

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/plugin-emitters-shape-circle - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

15

browser/EmittersCircleShape.js
import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
import { getRandom } from "@tsparticles/engine";
const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
export class EmittersCircleShape extends EmitterShapeBase {

@@ -11,10 +12,10 @@ constructor(position, size, fill, options) {

const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
const u = getRandom() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = getRandom();
if (v < 0.25) {
const u = getRandom() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = getRandom();
if (v < quarter) {
return theta;
}
else if (v < 0.5) {
else if (v < double * quarter) {
return Math.PI - theta;
}
else if (v < 0.75) {
else if (v < double * quarter + quarter) {
return Math.PI + theta;

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

}
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
return {
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
return Promise.resolve({
position: {

@@ -32,4 +33,4 @@ x: position.x + randomRadius * Math.cos(randomTheta),

},
};
});
}
}
import { EmittersCircleShapeGenerator } from "./EmittersCircleShapeGenerator.js";
export async function loadEmittersShapeCircle(engine, refresh = true) {
const emittersEngine = engine;
emittersEngine.addEmitterShapeGenerator &&
emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
await emittersEngine.refresh(refresh);
}

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

const engine_1 = require("@tsparticles/engine");
const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {

@@ -15,10 +16,10 @@ constructor(position, size, fill, options) {

const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
const u = (0, engine_1.getRandom)() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = (0, engine_1.getRandom)();
if (v < 0.25) {
const u = (0, engine_1.getRandom)() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = (0, engine_1.getRandom)();
if (v < quarter) {
return theta;
}
else if (v < 0.5) {
else if (v < double * quarter) {
return Math.PI - theta;
}
else if (v < 0.75) {
else if (v < double * quarter + quarter) {
return Math.PI + theta;

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

}
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
return {
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
return Promise.resolve({
position: {

@@ -36,5 +37,5 @@ x: position.x + randomRadius * Math.cos(randomTheta),

},
};
});
}
}
exports.EmittersCircleShape = EmittersCircleShape;

@@ -7,6 +7,5 @@ "use strict";

const emittersEngine = engine;
emittersEngine.addEmitterShapeGenerator &&
emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
await emittersEngine.refresh(refresh);
}
exports.loadEmittersShapeCircle = loadEmittersShapeCircle;
import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
import { getRandom } from "@tsparticles/engine";
const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
export class EmittersCircleShape extends EmitterShapeBase {

@@ -11,10 +12,10 @@ constructor(position, size, fill, options) {

const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
const u = getRandom() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = getRandom();
if (v < 0.25) {
const u = getRandom() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = getRandom();
if (v < quarter) {
return theta;
}
else if (v < 0.5) {
else if (v < double * quarter) {
return Math.PI - theta;
}
else if (v < 0.75) {
else if (v < double * quarter + quarter) {
return Math.PI + theta;

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

}
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
return {
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
return Promise.resolve({
position: {

@@ -32,4 +33,4 @@ x: position.x + randomRadius * Math.cos(randomTheta),

},
};
});
}
}
import { EmittersCircleShapeGenerator } from "./EmittersCircleShapeGenerator.js";
export async function loadEmittersShapeCircle(engine, refresh = true) {
const emittersEngine = engine;
emittersEngine.addEmitterShapeGenerator &&
emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
await emittersEngine.refresh(refresh);
}
{
"name": "@tsparticles/plugin-emitters-shape-circle",
"version": "3.0.3",
"version": "3.1.0",
"description": "tsParticles emitters shape circle plugin",

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

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

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

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

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

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

const quarter = 0.25,
EmittersCircleShape_double = 2,
doublePI = Math.PI * EmittersCircleShape_double,
squareExp = 2,
half = 0.5;
class EmittersCircleShape extends plugin_emitters_root_window_.EmitterShapeBase {

@@ -123,10 +128,10 @@ constructor(position, size, fill, options) {

generateTheta = (x, y) => {
const u = (0,engine_root_window_.getRandom)() / 4.0,
theta = Math.atan(y / x * Math.tan(2 * Math.PI * u)),
const u = (0,engine_root_window_.getRandom)() * quarter,
theta = Math.atan(y / x * Math.tan(doublePI * u)),
v = (0,engine_root_window_.getRandom)();
if (v < 0.25) {
if (v < quarter) {
return theta;
} else if (v < 0.5) {
} else if (v < EmittersCircleShape_double * quarter) {
return Math.PI - theta;
} else if (v < 0.75) {
} else if (v < EmittersCircleShape_double * quarter + quarter) {
return Math.PI + theta;

@@ -137,8 +142,8 @@ } else {

},
radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2),
[a, b] = [size.width / 2, size.height / 2],
radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp),
[a, b] = [size.width * half, size.height * half],
randomTheta = generateTheta(a, b),
maxRadius = radius(a, b, randomTheta),
randomRadius = fill ? maxRadius * Math.sqrt((0,engine_root_window_.getRandom)()) : maxRadius;
return {
return Promise.resolve({
position: {

@@ -148,3 +153,3 @@ x: position.x + randomRadius * Math.cos(randomTheta),

}
};
});
}

@@ -163,3 +168,3 @@ }

const emittersEngine = engine;
emittersEngine.addEmitterShapeGenerator && emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
await emittersEngine.refresh(refresh);

@@ -166,0 +171,0 @@ }

/*! For license information please see tsparticles.plugin.emitters.shape.circle.min.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,((e,t)=>(()=>{"use strict";var r={533:e=>{e.exports=t},68:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{loadEmittersShapeCircle:()=>s});var e=i(68),t=i(533);class r extends e.EmitterShapeBase{constructor(e,t,r,o){super(e,t,r,o)}async init(){}async randomPosition(){const e=this.size,r=this.fill,o=this.position,[i,n]=[e.width/2,e.height/2],s=((e,r)=>{const o=(0,t.getRandom)()/4,i=Math.atan(r/e*Math.tan(2*Math.PI*o)),n=(0,t.getRandom)();return n<.25?i:n<.5?Math.PI-i:n<.75?Math.PI+i:-i})(i,n),a=(d=s,(c=i)*(l=n)/Math.sqrt((l*Math.cos(d))**2+(c*Math.sin(d))**2)),p=r?a*Math.sqrt((0,t.getRandom)()):a;var c,l,d;return{position:{x:o.x+p*Math.cos(s),y:o.y+p*Math.sin(s)}}}}class o{generate(e,t,o,i){return new r(e,t,o,i)}}async function s(e,t=!0){const r=e;r.addEmitterShapeGenerator&&r.addEmitterShapeGenerator("circle",new o),await r.refresh(t)}})(),n})()));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,((e,t)=>(()=>{"use strict";var r={533:e=>{e.exports=t},68:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,i),s.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{i.r(s),i.d(s,{loadEmittersShapeCircle:()=>p});var e=i(68),t=i(533);const r=.25,o=2*Math.PI;class n extends e.EmitterShapeBase{constructor(e,t,r,o){super(e,t,r,o)}async init(){}async randomPosition(){const e=this.size,i=this.fill,s=this.position,[n,a]=[.5*e.width,.5*e.height],p=((e,i)=>{const s=(0,t.getRandom)()*r,n=Math.atan(i/e*Math.tan(o*s)),a=(0,t.getRandom)();return a<r?n:a<.5?Math.PI-n:a<.75?Math.PI+n:-n})(n,a),c=(f=p,(u=n)*(d=a)/Math.sqrt((d*Math.cos(f))**2+(u*Math.sin(f))**2)),l=i?c*Math.sqrt((0,t.getRandom)()):c;var u,d,f;return Promise.resolve({position:{x:s.x+l*Math.cos(p),y:s.y+l*Math.sin(p)}})}}class a{generate(e,t,r,o){return new n(e,t,r,o)}}async function p(e,t=!0){const r=e;r.addEmitterShapeGenerator?.("circle",new a),await r.refresh(t)}})(),s})()));

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

/*! tsParticles Emitters Shape Circle Plugin v3.0.3 by Matteo Bruni */
/*! tsParticles Emitters Shape Circle Plugin v3.1.0 by Matteo Bruni */

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

const engine_1 = require("@tsparticles/engine");
const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {

@@ -24,10 +25,10 @@ constructor(position, size, fill, options) {

const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
const u = (0, engine_1.getRandom)() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = (0, engine_1.getRandom)();
if (v < 0.25) {
const u = (0, engine_1.getRandom)() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = (0, engine_1.getRandom)();
if (v < quarter) {
return theta;
}
else if (v < 0.5) {
else if (v < double * quarter) {
return Math.PI - theta;
}
else if (v < 0.75) {
else if (v < double * quarter + quarter) {
return Math.PI + theta;

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

}
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
return {
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
return Promise.resolve({
position: {

@@ -45,3 +46,3 @@ x: position.x + randomRadius * Math.cos(randomTheta),

},
};
});
}

@@ -48,0 +49,0 @@ }

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

const emittersEngine = engine;
emittersEngine.addEmitterShapeGenerator &&
emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
await emittersEngine.refresh(refresh);

@@ -20,0 +19,0 @@ }

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