wufe / react-particles-js

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

Cannot load png or svg as image #33

Closed xeoneux closed 6 years ago

xeoneux commented 6 years ago

The library works well with the shapes provided but does not load images if I pass in

shape {
  type: "image",
  image: {
    src: "url_to_svg_or_png",
    width: 100,
    height: 100
  }
}

The error encountered is:

Uncaught TypeError: Cannot read property 'clearRect' of undefined
wufe commented 6 years ago

The library seems not to work with svg, but here's an example project with a png: Edit Image demo with typescript

wufe commented 6 years ago

Thanks to @wdavidw ( pr #35 ) you can now use svgs :

Edit Image demo with typescript