@tsparticles/path-branches 4.0.0-beta.0 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/138.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_path_branches=this.webpackChunk_tsparticles_path_branches||[]).push([[138],{138(e,t,n){n.d(t,{BranchesPathGenerator:()=>s});var i=n(303);let a={segmentLength:20,branchChance:.2,maxAngle:Math.PI/3,speedVariation:.3,inertia:{enable:!1,factor:.1}};class s{options;_container;_res;constructor(e){this._container=e,this._res=i.Vector.origin,this.options={...a,inertia:{...a.inertia}}}generate(e){let t=this.options;e.branching??={angle:(0,i.getRandom)()*i.doublePI,remaining:t.segmentLength,baseSpeed:e.velocity.length,speed:e.velocity.length};let n=e.branching;if(n.remaining<=0){let e=(0,i.getRandom)()<(t.branchChance??0),s=t.maxAngle??a.maxAngle,o=(2*(0,i.getRandom)()-1)*(e?s:.3*s);n.angle+=o,n.remaining=t.segmentLength;let r=1+(2*(0,i.getRandom)()-1)*(t.speedVariation??0);n.speed=n.baseSpeed*r}n.remaining-=n.speed;let s=Math.cos(n.angle)*n.speed,o=Math.sin(n.angle)*n.speed,r=t.inertia;if(r?.enable){let t=r.factor??.1;e.velocity.x+=(s-e.velocity.x)*t,e.velocity.y+=(o-e.velocity.y)*t,this._res.x=e.velocity.x,this._res.y=e.velocity.y}else e.velocity.x=0,e.velocity.y=0,this._res.x=s,this._res.y=o;return this._res}init(){let e=this._container.actualOptions.particles.move.path.options;this.options.segmentLength=e.segmentLength??this.options.segmentLength,this.options.branchChance=e.branchChance??this.options.branchChance,this.options.maxAngle=e.maxAngle??this.options.maxAngle,this.options.speedVariation=e.speedVariation??this.options.speedVariation;let t=e.inertia;if(t){let e={...a.inertia};e.enable=t.enable??e.enable,e.factor=t.factor??e.factor,this.options.inertia=e}}reset(e){delete e.branching}update(){}}}}]);
package/browser/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export const branchingPathName = "branchesPathGenerator";
2
2
  export async function loadBranchesPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
3
+ engine.checkVersion("4.0.0-beta.1");
4
+ await engine.pluginManager.register(async (e) => {
5
5
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
6
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(branchingPathName, async (container) => {
7
+ e.pluginManager.addPathGenerator?.(branchingPathName, async (container) => {
8
8
  const { BranchesPathGenerator } = await import("./BranchesPathGenerator.js");
9
9
  return new BranchesPathGenerator(container);
10
10
  });
package/cjs/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export const branchingPathName = "branchesPathGenerator";
2
2
  export async function loadBranchesPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
3
+ engine.checkVersion("4.0.0-beta.1");
4
+ await engine.pluginManager.register(async (e) => {
5
5
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
6
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(branchingPathName, async (container) => {
7
+ e.pluginManager.addPathGenerator?.(branchingPathName, async (container) => {
8
8
  const { BranchesPathGenerator } = await import("./BranchesPathGenerator.js");
9
9
  return new BranchesPathGenerator(container);
10
10
  });
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-beta.0
7
+ * v4.0.0-beta.1
8
8
  */
9
9
  "use strict";
10
10
  /*
package/esm/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export const branchingPathName = "branchesPathGenerator";
2
2
  export async function loadBranchesPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
3
+ engine.checkVersion("4.0.0-beta.1");
4
+ await engine.pluginManager.register(async (e) => {
5
5
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
6
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(branchingPathName, async (container) => {
7
+ e.pluginManager.addPathGenerator?.(branchingPathName, async (container) => {
8
8
  const { BranchesPathGenerator } = await import("./BranchesPathGenerator.js");
9
9
  return new BranchesPathGenerator(container);
10
10
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/path-branches",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "tsParticles branches path",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -104,8 +104,8 @@
104
104
  "./package.json": "./package.json"
105
105
  },
106
106
  "dependencies": {
107
- "@tsparticles/engine": "4.0.0-beta.0",
108
- "@tsparticles/plugin-move": "4.0.0-beta.0"
107
+ "@tsparticles/engine": "4.0.0-beta.1",
108
+ "@tsparticles/plugin-move": "4.0.0-beta.1"
109
109
  },
110
110
  "type": "module"
111
111
  }