Straight Particles Effect

Pict2Pix.js library
Straight Particles Effect

Setting up Straight Particles Effect

  • Get the image element and call to pict2pix.animate function
    const imagejh = document.getElementById('image-jh');
    
    window.onload = function initialize() {
      pict2pix.animate({
          image: imagejh,
          particleType: 'straight-particle',
          numberOfParticles: 800,
          horizontalSpeed: -1,
          verticalSpeed: -1
      });
    }
  • Options
    • image: Required. The html element to apply the effect
    • particleType: Required. The effect to apply to the image. In this case is 'straight-particle'
    • numberOfParticles: Optional. Number of particles in the image. Be careful about the perfomance if you add a big number of particles. Default value is 3000.
    • horizontalSpeed: Optional. Horizontal speed of the particles. Can be positive or negative. Zero for no Horizontal movement. Default value is 1.
    • verticalSpeed: Optional. Vertical speed of the particles. Can be positive or negative. Zero for no vertical movement. Default value is 1.