VincentGarreau / particles.js

A lightweight JavaScript library for creating particles
https://vincentgarreau.com/particles.js/
MIT License
28.72k stars 4.81k forks source link

How add Multiple Images in Particles.js #106

Open BehroozBvk opened 8 years ago

BehroozBvk commented 8 years ago

Hi, Wondering How add Multiple Images in Particles.js

mikenewbon commented 7 years ago

https://github.com/athletics/particles

Koeroesi86 commented 6 years ago

This seems like a sad story so far: https://github.com/VincentGarreau/particles.js/blob/master/particles.js#L380

mohammedgqudah commented 5 years ago

any updates in 2018??

firestar300 commented 5 years ago

It works using https://github.com/Wufe/react-particles-js

"shape": {
  "type": "images",
  "stroke": {
    "width": 0,
    "color": "#000"
  },
  "polygon": {
    "nb_sides": 6
  },
  "images": [
    {
      "src": "img/shapes/0.svg",
      "width": 100,
      "height": 100
    },
    {
      "src": "img/shapes/1.svg",
      "width": 100,
      "height": 100
    }
  ]
},
chrisunderdown commented 5 years ago

It works !

"shape": {
  "type": "images",
  "stroke": {
    "width": 0,
    "color": "#000"
  },
  "polygon": {
    "nb_sides": 6
  },
  "images": [
    {
      "src": "img/shapes/0.svg",
      "width": 100,
      "height": 100
    },
    {
      "src": "img/shapes/1.svg",
      "width": 100,
      "height": 100
    }
  ]
},

Doesn't work for me? Did you make any changes to particles.js?

firestar300 commented 5 years ago

@chrisunderdown no I didn't.

firestar300 commented 5 years ago

@chrisunderdown check the path of your images.

TOcvfan commented 5 years ago

I doesn't work for me

Fenny commented 5 years ago

@firestar300 are you using https://github.com/VincentGarreau/particles.js ?

vjandrei commented 5 years ago

not working here either

It works !

"shape": {
  "type": "images",
  "stroke": {
    "width": 0,
    "color": "#000"
  },
  "polygon": {
    "nb_sides": 6
  },
  "images": [
    {
      "src": "img/shapes/0.svg",
      "width": 100,
      "height": 100
    },
    {
      "src": "img/shapes/1.svg",
      "width": 100,
      "height": 100
    }
  ]
},
erichlotto commented 5 years ago

Any updates on this? Are there other libraries available that works? (https://github.com/athletics/particles doesn't work on firefox)

firestar300 commented 5 years ago

It's very weird. I used theses settings in production : https://100.iccwbo.org/

As you can see, there are several SVG path in background. @Fenny , I used the React component of ParticleJS https://www.npmjs.com/package/react-particles-js

firestar300 commented 5 years ago

Upon further investigation, images shape type only works on the React component of ParticleJS. https://github.com/Wufe/react-particles-js/blob/master/src/lib/Particle.ts

fogsy commented 5 years ago

is multiple images working without react?

salemalem commented 5 years ago

is multiple images working without react?

Same question

firestar300 commented 5 years ago

No it doesn't.

dsusco commented 4 years ago

I created a PR for multiple images. Just make particles.shape.image an array.

https://github.com/VincentGarreau/particles.js/pull/390

It includes another PR for a "destroy" out mode. I needed multi-colored balloons to fly off the top of the screen. You know... important website stuff.

matteobruni commented 4 years ago

If anyone needs this feature this library has it, it's the new core of react-particles-js but React is not required, it's a library like particles.js