wufe / react-particles-js

Particles.js for React
https://rpj.bembi.dev/
MIT License
1.15k stars 108 forks source link

Image src using data uri seems broken #118

Closed samotoo closed 4 years ago

samotoo commented 4 years ago

Hi,

First of all, thx so much for the wonderful library.

I met a issue after upgrading to 3.1.0. Here is the snippet of my config:

      shape: {
        type: "images",
        images: sprites.map(item => {
          return { src: item, height: 20, width: 20 };
        })
      }

The item here is actually a image data uri, not a path, and chrome console display the following error:

Container.js:6 Uncaught (in promise) Error tsParticles - No image.src

And particles are not displayed. Downgrading to 2.7.1 resolves the issue. I guess maybe the tsParticles library doesn't support data uri? I searched their repo but no findings.

matteobruni commented 4 years ago

Hi @samotoo, I've opened an issue in the tsParticles repository because it's an unexpected behavior. I tried with a data uri in a demo json and it works fine.

Is it possible to have the URI you are using?

samotoo commented 4 years ago

Hi @matteobruni, thanks for the quick response.

How stupid I was! I didn't notice that the parameters have changed from images to image until I checked the multiple images demo page. After correcting the parameters, everything works well.

BTW, the readme of this project is still using the outdated paramter I think it would be better to update it when you have time: image

Since this is not a functional issue I will close it. Thanks again for your kind support, Grazie!

matteobruni commented 4 years ago

The readme can stay like this, I didn't see the shape type 'images' and it will be added to tsParticles 1.13.1.