tsparticles / astro

tsParticles Astro official component
MIT License
33 stars 4 forks source link

How do I switch themes using Astro? #3

Closed KenjiPcx closed 1 year ago

KenjiPcx commented 1 year ago

Hi, I have been trying to switch themes using ts-particles, I have seen your codepen https://codepen.io/matteobruni/pen/MWopjRP for switching themes using vanilla js, but I am wondering how to do it in Astro, because I can't get the theme container

matteobruni commented 1 year ago

Since there's no particlesLoaded function, you can get tsParticles running instances using tsParticles.domItem(<index>), importing tsParticles like in the readme. I haven't found a way to pass functions to an Astro component, so that's the only way for now.

KenjiPcx commented 1 year ago

Oh nice, I'll try it out 😃 thanks

KenjiPcx commented 1 year ago

Tried this out and it works 🔥, closing the issue