1

有没有办法在粒子js中添加多个图像?我搜索了解决方案,但找不到任何工作。

这是我的particle.json 设置。

      "shape": {
        "type": "image",
        "stroke":{
        "width": 2,
        "color": "#a80cc0"
      },
      "polygon": {
        "nb_sides": 5
      },
      "image": {
        "src": "./assets/images/gift.png",
        "width": 100,
        "height": 100
      }
    },
4

1 回答 1

2

我查看了particlejs的来源,我认为没有这种可能性。虽然它应该与 React 组件一起使用:https ://github.com/Wufe/react-particles-js

但作为解决方法,您可以使用多个具有不同图像的particlejs 实例。

请参阅此问题https://github.com/VincentGarreau/particles.js/issues/324

那么它可能看起来像这样:https ://github.com/Dubprocessor/multiple-particlesjs-instances-example/tree/master

考虑到大量实例会影响性能。

于 2019-04-08T15:27:52.763 回答