tsparticles / vue3

Vue.js tsParticles official component
MIT License
121 stars 7 forks source link

How to use other generators? #5

Closed 34r7h closed 1 year ago

34r7h commented 1 year ago

Hi again, sorry to be annoying. I can't see in the source code how to use another generator, like polygonPathGenerator. I put the same options for some hex animation from a tsparticle codepen, but instead of hex's it's making straight line out from the middle

matteobruni commented 1 year ago

You need to call the function described here: https://github.com/matteobruni/tsparticles/tree/main/paths/polygon#readme

You can call that function in the particlesInit function, after the loadFull or any similar load that you have there.

34r7h commented 1 year ago

Thanks, I called it in particlesInit, passing the same engine. Works lovely. Cheers brother!

const particlesInit = async (engine: Engine) => {
  await loadFull(engine);
  loadPolygonPath(engine);
};
matteobruni commented 1 year ago

Thanks, I called it in particlesInit, passing the same engine. Works lovely. Cheers brother!

const particlesInit = async (engine: Engine) => {
  await loadFull(engine);
  loadPolygonPath(engine);
};

It's better to place an await in front of loadPolygonPath too, It's something that will be fixed in the v3 documentation

34r7h commented 1 year ago

cool thanks for the best practice!