particles.js
particles.js copied to clipboard
Where is the object
Im confused. I run your demos and examples all great, no probs. But now I want to dynamically, at runtime, modify some properties. You say I can use the pJS object pJS.particles.color_random = true;
but every time I try to use it I get JS error, undefined,
where is that object, how can I access it, its never declared or used in your demos
thank you
Yeah, some documentation on how to access particlesJS properties would be magic.
pJSDom[0]
is the first pJS object that you can access and change its particles
properties.
Slight adendum to NorlingArt's answer:
The options are accessible within pJSDom[0].pJS
So to change the particles speed: pJSDom[0].pJS.particles.speed = 50; etc.
It is literally pJSDom[0], he is not referring to a placeholder, you just write pJSDom[0] in your code, and then pJS and the property you want to change.
Pretty straightforward, but somehow confusing.
PD: remember to pJSDom[0].pJS.fn.particlesRefresh()
I'm facing the same issue, pJSDom is empty and I'm not able to access pJS at 0 position. How can I change the color dynamically?
pJSDom[0].pJS.particles.color.value = '#FF0000';
pJSDom[0].pJS.fn.particlesRefresh();
I get the below following error:
Uncaught TypeError: Cannot read property 'pJS' of undefined at HTMLDocument.<anonymous> (background-script.js?ver=1.2.0:19)