Open cyrilchapon opened 1 year ago
hi @cyrilchapon , I understand and like this modification ... however, what if we didn't make it breaking/incompatible?
if I'm not mistaken, this line;
this.count = Math.ceil((this.resolution / BASE_RESOLUTION) * this.settings.density);
could be changed to;
this.count = Math.ceil(
typeof this.settings.density !== "undefined" ?
this.resolution / BASE_RESOLUTION * this.settings.density :
this.settings.count
);
which would allow for anyone using count
to continue doing so?
Hey @simeydotme,
This is not stupid at all; I'd slightly change it though, maybe making (and documenting) the opposite (density
prioritized over count
), to make density
the new-normal; but keep backward compatibility with count
. Maybe marking count
deprecated in the code, but still working.
(the reason being simple : density
being way less dangerous than count
for lower resolution, despite the warning on homepage)
I wrote that quite late, but I think it is doing just as you propose; if density is undefined, then use count. but if density is defined; use density. and all the other code (default density, and document density) remains. so new users will be using density, and old users will have no problems.
Hi,
Reading the warning about mobile performance; it came to me the idea that
count
is practically a nonsense in a resizable environment.When implementing "snow" effect for example; what you want is a constant visual density, instead of a constant "number of flakes". Thus, I implemented a new
density
logic. I defaulted this to keep the same count as of today on a classic fullscreen desktop container (1400 * 660).It will recalculate the
count
, which is now dynamic based ondensity
xresolution
.It's also less dangerous on mobile; based on the naïve principle of "a larger screen resolution basically often mean a stronger GPU calculation capacities".
This is a breaking change, non backward compatible