Particles.js: Stopping the Animation from javascript

Created on 21 Jan 2016  路  6Comments  路  Source: VincentGarreau/particles.js

Hi,
Is there any chance to stop the animation using javascript, after it started running?
I tried to find the Code inside your Examples GUI, but was unable to find how you disable the animation afterwards..

Most helpful comment

Hey @XRyu ,

You can do it by this way:

pJSDom[0].pJS.particles.move.enable = false;

To restart:

pJSDom[0].pJS.particles.move.enable = true;
pJSDom[0].pJS.fn.particlesRefresh();

All 6 comments

Hey @XRyu ,

You can do it by this way:

pJSDom[0].pJS.particles.move.enable = false;

To restart:

pJSDom[0].pJS.particles.move.enable = true;
pJSDom[0].pJS.fn.particlesRefresh();

Is there a similar method for turning interactivity on and off?

pJSDom[0].pJS.interactivity.events.onclick["enable"] = false;

Is it possible to pause the movement, and then re-enable it without refreshing?

I want to pause an animation while the user is scrolling.

@VincentGarreau, thanks so much!

Is it possible to pause the movement, and then re-enable it without refreshing?

I want to pause an animation while the user is scrolling.

pause() {
      this._tempFn = this.pJS.fn.vendors.draw
      window.pJSDom[0].pJS.fn.vendors.draw = () => {
      }
    }
    play() {
      window.pJSDom[0].pJS.fn.vendors.draw = this._tempFn
      window.pJSDom[0].pJS.fn.vendors.draw()
    }
Was this page helpful?
0 / 5 - 0 ratings