react-particles-js: plygon mask with SVG image does not work
Library works perfectly for simple, bubble, multiple images but does not work for Polygon mask. Please see below code. Am i missing something? It just shows a blank screen. Could you help please.
import React, { Component } from "react";
import Particles from "react-particles-js";
import "./Home.css";
export class Home extends Component {
render() {
return (
<div class="particles">
<Particles
params={{
fps_limit: 28,
particles: {
number: { value: 200, density: { enable: false } },
line_linked: { enable: true, distance: 30, opacity: 0.4 },
move: { speed: 1 },
opacity: {
anim: {
enable: true,
opacity_min: 0.05,
speed: 2,
sync: false
},
value: 0.4
}
},
polygon: {
enable: true,
scale: 0.5,
type: "inline",
move: { radius: 10 },
url: "/smalldeer.svg",
inline: { arrangement: "equidistant" },
draw: {
enable: true,
stroke: { color: "rgba(255, 255, 255, .2)" }
}
},
retina_detect: false,
interactivity: {
events: { onhover: { enable: true, mode: "bubble" } },
modes: { bubble: { size: 6, distance: 40 } }
}
}}
/>
</div>
);
}
}
export default Home;
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (8 by maintainers)
Hey @matteobruni thanks for the tip. I’ve been able to render all the templates you’ve provided, so thank you for all those examples. Also, I just realized that my default GitHub image may inadvertently be giving you the eye troubles you referenced earlier… lol my b
thank you, that helped the problem was in the svg file itself 😉
Sorry, my bad. my Chrome console log level was set to display only information. It’s changed back to verbose and it did show the actual error, which was causing the issue.
cannot read property ‘numberOfItems’ of undefined when polygon is on
Adding this reference resolved the issue.
<script src="https://cdn.rawgit.com/progers/pathseg/master/pathseg.js"></script>