Tsparticles: Help undestanding particles.number

Created on 10 Sep 2020  路  2Comments  路  Source: matteobruni/tsparticles

Since I can't find docs for particles.number I've tried experimenting with the demo editor to figure out the settings. I've enabled the "More" > "Toggle Stats" option to see the current particle number. Unfortunately I still can't seem to understand the config options.

Why does the following config render 18 particles on the screen (according to the stats box)? My expectation is 10 rendered particles.

"number": {
  "density": {
    "enable": false,
    "area": 800,
    "factor": 1000
  },
  "limit": 0,
  "value": 10
}

image

Why does the following config render 2 particles on the screen (according to the stats box)? My expectation is 1 rendered particle.

"number": {
  "density": {
    "enable": false,
    "area": 800,
    "factor": 1000
  },
  "limit": 1,
  "value": 10
}

What is the unit of density.area. Is it the number of particles per 800x800 pixels?
What does the density.factor mean?

question

Most helpful comment

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.67. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

All 2 comments

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.67. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Hi @hidarikani,

Those values are used in the formula used here

this.density = (canvas.width * canvas.height) / (densityOptions.factor * pxRatio * densityOptions.area);

// this.density will be multiplied with the particles.number value

This formula is inherited from particles.js changing a hard coded value with a customizable factor.

Disabling the density should use only the value for the count, if it鈥檚 not it鈥檚 a bug I need to investigate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matteobruni picture matteobruni  路  6Comments

microraptor picture microraptor  路  3Comments

matteobruni picture matteobruni  路  5Comments

adammesa picture adammesa  路  4Comments

nikse picture nikse  路  4Comments