tsparticles / tsparticles

tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.
https://particles.js.org
MIT License
7.24k stars 803 forks source link

[Bug]: change the background to a picture but it doesn't work #5316

Closed visualczm closed 3 months ago

visualczm commented 3 months ago

Contact Details

448443959@qq.com

What happened?

<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-fountain@3/tsparticles.preset.fountain.bundle.min.js"></script>
tsParticles.load({
  id: "tsparticles",
  options: {
    particles: {
      shape: {
        type: "square", // starting from v2, this require the square shape script
      },
    },
    preset: "fountain",
  },
});

I want to create a welcome effect for the company. I can set a background image and add text at the same time.

tsParticles Version

CDN version3

tsParticles Configuration

const configs = { 
  id: "tsparticles",
options: 
{ 
  preset:"fountain",
  background: {
    image: "url('background3.jpg')",
    position: '50% 50%',
    repeat: 'no-repeat',
    size: 'cover',
    opacity: 1
  },
  particles: {
  opacity: {
    value: 1
},
}}}

What browsers are you seeing the problem on?

Microsoft Edge

Relevant log output

The background image flashes and then disappears

Code of Conduct

matteobruni commented 3 months ago

Duplicate of #4244