@tsparticles/confetti 4.1.2 → 4.1.3

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.
@@ -17,7 +17,7 @@ import { loadWobbleUpdater } from "@tsparticles/updater-wobble";
17
17
  import { setConfetti } from "./utils.js";
18
18
  let initPromise = null;
19
19
  async function doInitPlugins(engine) {
20
- engine.checkVersion("4.1.2");
20
+ engine.checkVersion("4.1.3");
21
21
  await engine.pluginManager.register(async (e) => {
22
22
  await Promise.all([
23
23
  loadBasic(e),
@@ -90,5 +90,5 @@ confetti.create = async (canvas, options = {}) => {
90
90
  confetti.init = async () => {
91
91
  await initPlugins(tsParticles);
92
92
  };
93
- confetti.version = "4.1.2";
93
+ confetti.version = "4.1.3";
94
94
  globalThis.confetti = confetti;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { setConfetti } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.1.2");
5
+ engine.checkVersion("4.1.3");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadEmittersPluginSimple }, { loadMotionPlugin }, { loadCardSuitsShape }, { loadEmojiShape }, { loadHeartShape }, { loadImageShape }, { loadPolygonShape }, { loadSquareShape }, { loadStarShape }, { loadRotateUpdater }, { loadLifeUpdater }, { loadRollUpdater }, { loadTiltUpdater }, { loadWobbleUpdater },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -92,5 +92,5 @@ confetti.create = async (canvas, options = {}) => {
92
92
  confetti.init = async () => {
93
93
  await initPlugins(tsParticles);
94
94
  };
95
- confetti.version = "4.1.2";
95
+ confetti.version = "4.1.3";
96
96
  globalThis.confetti = confetti;
package/browser/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { millisecondsToSeconds } from "@tsparticles/engine";
1
+ import { defaultFps, percentDenominator } from "@tsparticles/engine";
2
2
  import { ConfettiOptions } from "./ConfettiOptions.js";
3
- const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, ids = new Map();
3
+ const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, noOpacityChange = 0, ids = new Map(), minTicks = 0;
4
4
  export async function addEmitter(container, actualOptions, opacitySpeed) {
5
5
  await container.addEmitter?.({
6
6
  startCount: actualOptions.count,
@@ -251,7 +251,7 @@ export function convertOptions(actualOptions, params, opacitySpeed) {
251
251
  export async function setConfetti(engine, params) {
252
252
  const actualOptions = new ConfettiOptions();
253
253
  actualOptions.load(params.options);
254
- const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = (fpsLimitFactor * fpsLimit * millisecondsToSeconds) / (actualOptions.ticks * millisecondsToSeconds);
254
+ const fpsLimit = 120, safeTicks = Number.isFinite(actualOptions.ticks) && actualOptions.ticks > minTicks ? actualOptions.ticks : undefined, opacitySpeed = safeTicks === undefined ? noOpacityChange : (fpsLimit * percentDenominator) / (defaultFps * safeTicks);
255
255
  let containerOrPromise = ids.get(params.id);
256
256
  if (containerOrPromise instanceof Promise) {
257
257
  await containerOrPromise;
package/cjs/confetti.js CHANGED
@@ -17,7 +17,7 @@ import { loadWobbleUpdater } from "@tsparticles/updater-wobble";
17
17
  import { setConfetti } from "./utils.js";
18
18
  let initPromise = null;
19
19
  async function doInitPlugins(engine) {
20
- engine.checkVersion("4.1.2");
20
+ engine.checkVersion("4.1.3");
21
21
  await engine.pluginManager.register(async (e) => {
22
22
  await Promise.all([
23
23
  loadBasic(e),
@@ -90,5 +90,5 @@ confetti.create = async (canvas, options = {}) => {
90
90
  confetti.init = async () => {
91
91
  await initPlugins(tsParticles);
92
92
  };
93
- confetti.version = "4.1.2";
93
+ confetti.version = "4.1.3";
94
94
  globalThis.confetti = confetti;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { setConfetti } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.1.2");
5
+ engine.checkVersion("4.1.3");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadEmittersPluginSimple }, { loadMotionPlugin }, { loadCardSuitsShape }, { loadEmojiShape }, { loadHeartShape }, { loadImageShape }, { loadPolygonShape }, { loadSquareShape }, { loadStarShape }, { loadRotateUpdater }, { loadLifeUpdater }, { loadRollUpdater }, { loadTiltUpdater }, { loadWobbleUpdater },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -92,5 +92,5 @@ confetti.create = async (canvas, options = {}) => {
92
92
  confetti.init = async () => {
93
93
  await initPlugins(tsParticles);
94
94
  };
95
- confetti.version = "4.1.2";
95
+ confetti.version = "4.1.3";
96
96
  globalThis.confetti = confetti;
package/cjs/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { millisecondsToSeconds } from "@tsparticles/engine";
1
+ import { defaultFps, percentDenominator } from "@tsparticles/engine";
2
2
  import { ConfettiOptions } from "./ConfettiOptions.js";
3
- const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, ids = new Map();
3
+ const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, noOpacityChange = 0, ids = new Map(), minTicks = 0;
4
4
  export async function addEmitter(container, actualOptions, opacitySpeed) {
5
5
  await container.addEmitter?.({
6
6
  startCount: actualOptions.count,
@@ -251,7 +251,7 @@ export function convertOptions(actualOptions, params, opacitySpeed) {
251
251
  export async function setConfetti(engine, params) {
252
252
  const actualOptions = new ConfettiOptions();
253
253
  actualOptions.load(params.options);
254
- const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = (fpsLimitFactor * fpsLimit * millisecondsToSeconds) / (actualOptions.ticks * millisecondsToSeconds);
254
+ const fpsLimit = 120, safeTicks = Number.isFinite(actualOptions.ticks) && actualOptions.ticks > minTicks ? actualOptions.ticks : undefined, opacitySpeed = safeTicks === undefined ? noOpacityChange : (fpsLimit * percentDenominator) / (defaultFps * safeTicks);
255
255
  let containerOrPromise = ids.get(params.id);
256
256
  if (containerOrPromise instanceof Promise) {
257
257
  await containerOrPromise;
package/esm/confetti.js CHANGED
@@ -17,7 +17,7 @@ import { loadWobbleUpdater } from "@tsparticles/updater-wobble";
17
17
  import { setConfetti } from "./utils.js";
18
18
  let initPromise = null;
19
19
  async function doInitPlugins(engine) {
20
- engine.checkVersion("4.1.2");
20
+ engine.checkVersion("4.1.3");
21
21
  await engine.pluginManager.register(async (e) => {
22
22
  await Promise.all([
23
23
  loadBasic(e),
@@ -90,5 +90,5 @@ confetti.create = async (canvas, options = {}) => {
90
90
  confetti.init = async () => {
91
91
  await initPlugins(tsParticles);
92
92
  };
93
- confetti.version = "4.1.2";
93
+ confetti.version = "4.1.3";
94
94
  globalThis.confetti = confetti;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { setConfetti } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.1.2");
5
+ engine.checkVersion("4.1.3");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadEmittersPluginSimple }, { loadMotionPlugin }, { loadCardSuitsShape }, { loadEmojiShape }, { loadHeartShape }, { loadImageShape }, { loadPolygonShape }, { loadSquareShape }, { loadStarShape }, { loadRotateUpdater }, { loadLifeUpdater }, { loadRollUpdater }, { loadTiltUpdater }, { loadWobbleUpdater },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -92,5 +92,5 @@ confetti.create = async (canvas, options = {}) => {
92
92
  confetti.init = async () => {
93
93
  await initPlugins(tsParticles);
94
94
  };
95
- confetti.version = "4.1.2";
95
+ confetti.version = "4.1.3";
96
96
  globalThis.confetti = confetti;
package/esm/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { millisecondsToSeconds } from "@tsparticles/engine";
1
+ import { defaultFps, percentDenominator } from "@tsparticles/engine";
2
2
  import { ConfettiOptions } from "./ConfettiOptions.js";
3
- const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, ids = new Map();
3
+ const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, noOpacityChange = 0, ids = new Map(), minTicks = 0;
4
4
  export async function addEmitter(container, actualOptions, opacitySpeed) {
5
5
  await container.addEmitter?.({
6
6
  startCount: actualOptions.count,
@@ -251,7 +251,7 @@ export function convertOptions(actualOptions, params, opacitySpeed) {
251
251
  export async function setConfetti(engine, params) {
252
252
  const actualOptions = new ConfettiOptions();
253
253
  actualOptions.load(params.options);
254
- const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = (fpsLimitFactor * fpsLimit * millisecondsToSeconds) / (actualOptions.ticks * millisecondsToSeconds);
254
+ const fpsLimit = 120, safeTicks = Number.isFinite(actualOptions.ticks) && actualOptions.ticks > minTicks ? actualOptions.ticks : undefined, opacitySpeed = safeTicks === undefined ? noOpacityChange : (fpsLimit * percentDenominator) / (defaultFps * safeTicks);
255
255
  let containerOrPromise = ids.get(params.id);
256
256
  if (containerOrPromise instanceof Promise) {
257
257
  await containerOrPromise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/confetti",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -105,22 +105,22 @@
105
105
  "./package.json": "./package.json"
106
106
  },
107
107
  "dependencies": {
108
- "@tsparticles/basic": "4.1.2",
109
- "@tsparticles/engine": "4.1.2",
110
- "@tsparticles/plugin-emitters": "4.1.2",
111
- "@tsparticles/plugin-motion": "4.1.2",
112
- "@tsparticles/shape-cards": "4.1.2",
113
- "@tsparticles/shape-emoji": "4.1.2",
114
- "@tsparticles/shape-heart": "4.1.2",
115
- "@tsparticles/shape-image": "4.1.2",
116
- "@tsparticles/shape-polygon": "4.1.2",
117
- "@tsparticles/shape-square": "4.1.2",
118
- "@tsparticles/shape-star": "4.1.2",
119
- "@tsparticles/updater-life": "4.1.2",
120
- "@tsparticles/updater-roll": "4.1.2",
121
- "@tsparticles/updater-rotate": "4.1.2",
122
- "@tsparticles/updater-tilt": "4.1.2",
123
- "@tsparticles/updater-wobble": "4.1.2"
108
+ "@tsparticles/basic": "4.1.3",
109
+ "@tsparticles/engine": "4.1.3",
110
+ "@tsparticles/plugin-emitters": "4.1.3",
111
+ "@tsparticles/plugin-motion": "4.1.3",
112
+ "@tsparticles/shape-cards": "4.1.3",
113
+ "@tsparticles/shape-emoji": "4.1.3",
114
+ "@tsparticles/shape-heart": "4.1.3",
115
+ "@tsparticles/shape-image": "4.1.3",
116
+ "@tsparticles/shape-polygon": "4.1.3",
117
+ "@tsparticles/shape-square": "4.1.3",
118
+ "@tsparticles/shape-star": "4.1.3",
119
+ "@tsparticles/updater-life": "4.1.3",
120
+ "@tsparticles/updater-roll": "4.1.3",
121
+ "@tsparticles/updater-rotate": "4.1.3",
122
+ "@tsparticles/updater-tilt": "4.1.3",
123
+ "@tsparticles/updater-wobble": "4.1.3"
124
124
  },
125
125
  "publishConfig": {
126
126
  "access": "public"