React tsParticles(烟花)不起作用

问题描述 投票:0回答:1

我正在尝试使用react-tsParticle。我对“烟花预设”感兴趣,但不幸的是这不起作用。 我已经播种了一些示例,例如 this codepen one。 但如果我使用该选项/配置则不起作用。它在底部产生了一些烟花爆炸,但毫无用处截图

但是如果我以这种方式使用那个

codepen
示例就可以了。但这并不是它在 React 中的使用方式。任何帮助将不胜感激。

reactjs particles
1个回答
0
投票

尝试这个选项:

const options = {
preset: "fireworks",
sounds: {
  enable: true,
},
particles: {
  move: {
    speed: 1,
  },
},
interactivity: {
  detectsOn: "canvas",
  events: {
    resize: true,
    click: {
      enable: true,
      mode: "push",
    },
  },
},
maxParticles: 3,
fpsLimit: 60,
emitters: [
  {
    direction: "top",
    life: {
      count: 1000,
      duration: 0.2,
      delay: 1,
    },
  },
],
};
© www.soinside.com 2019 - 2024. All rights reserved.