I am trying to display a set of images as particles and I would like each image to be displayed exactly once. Currently is not possible, because each particle gets assigned a random image, thus some of the images will appear multiple times and others won't show at all.
Would it be possible to have an additional configuration option specifically for preventing duplicates as much as possible?
It could be a boolean option like reduceDuplicates under params.particles.shape options and when enabled, following behaviour would be expected:
params.particles.number.limit <= image array length, then there will be no duplicatesparams.particles.number.limit > image array length, then duplicates are to be expectedI am seeing as possible implementation to have 2 image arrays: original and copy. The original array would be immutable, and the copy array would get consumed with each particle that gets generated, then when the copy array gets empty, will get refreshed from the original array.
Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.87. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Hi @ovidyou, thanks for the idea.
I was thinking about it for a while but I was focused in other more complex features. Since this is requested I'll introduce it in 1.17.x.
If you want to try yourself to add this feature feel free to contribute.
@matteobruni alright, will try to implement this feature
Thanks! Just a reminder, use dev branch for this feature.
Hi there!
I was about to open a request for this exact issue! So happy someone else needs the same functionality. I created a custom shape (drawer) that accepts an array of labels and colors for the particles. It would be great if the sets were repeated rather than random individual particles. (See attached screenshot - I had to refresh the page a few times to see a complete set of particles.)
I would also like to ask a question about how to programmatically add particles - it's not an issue - I just need some assistance. Is there a support forum? I would like to add a particle when someone completes a form.
Any assistance would be appreciated!
Thanks,
Sonya

Hi @sonya-ninja, sorry but there's no forum atm.
If you want to add particles programmatically you can check this pen: https://codepen.io/matteobruni/pen/GRpYdGv
It uses the addParticle method, it's really simple
Thanks so much! Will check it out.
I forgot a thing, if you want more direct support there's a Slack, the invite is in the Readme
Reducing duplicates can be applied to other shapes too including color and shape type and text particles.
Imagining the scenario with 3 colors set and shape types of square, circle and polygon (pentagon) the result would be 3 colored square, three colored circles and three colored polygons repeated particles number / combinations times.
Sizes and Opacity should not be considered, color animation neither.
For shapes that can have multiple values like images every value count as a combination
@matteobruni sure, can apply to other shapes as well.
Wat do you think about having an option, say generateMode that would accept 3 different modes:
Yes it's fine. Colors (fill and stroke) should be considered too in generation order, not just shapes.
Every shape can have multiple values by design, there are not many samples with that configuration but I can create some of these.
Colors can have a "random" value, this should be considered like a single value for every shape
This issue won't be in 1.17.0, it'll be scheduled in another version because it needs some extra work and I'd like to release 1.17.0 soon, I need to start making tests of the upcoming release.
Most helpful comment
@matteobruni alright, will try to implement this feature