Get started with tsparticles-interaction-particles-attract CDN

MIT licensed

TSParticles-Interaction-Particles-Attract: Three.js library for attractive particle interactions.

Tags:
  • tsparticles
  • particles.js
  • particlesjs
  • particles
  • particle
  • canvas
  • jsparticles
  • xparticles
  • particles-js
  • particles-bg
  • particles-bg-vue
  • particles-ts
  • particles.ts
  • react-particles-js
  • react-particles.js
  • react-particles
  • react
  • reactjs
  • vue-particles
  • ngx-particles
  • angular-particles
  • particleground
  • vue
  • vuejs
  • preact
  • preactjs
  • jquery
  • angularjs
  • angular
  • typescript
  • javascript
  • animation
  • web
  • html5
  • web-design
  • webdesign
  • css
  • html
  • css3
  • animated
  • background
  • confetti
  • fireworks
  • fireworks-js
  • confetti-js
  • confettijs
  • fireworksjs
  • canvas-confetti

Stable version

Copied!

How to start using tsparticles-interaction-particles-attract CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with tsparticles-interaction-particles-attract CDN - cdnhub.io</title>
  <style>
    #tsparticles {
      height: 100vh;
      width: 100vw;
    }
  </style>
</head>
<body>
  <div id="tsparticles"></div>
  <script src="https://cdn.jsdelivr.net/npm/worksans@4.2.0/worksans.min.css"></script>
  <script src="https://cdn.jsdelivr.net/npm/tsparticles@0.16.2/tsparticles.min.js"></script>
  <script src="https://cdn.cdnhub.io/tsparticles-interaction-particles-attract/2.12.0/tsparticles.interaction.particles.attract.min.js"></script>
  <script>
    const particles = new TSParticles({
      id: 'tsparticles',
      container: document.querySelector('#tsparticles'),
      width: window.innerWidth,
      height: window.innerHeight,
      backgroundMode: {
        enable: true,
        color: '#000'
      },
      particles: {
        number: {
          value: 50,
          density: {
            enable: true,
            value_area: 800
          }
        },
        color: {
          value: '#fff'
        },
        shape: {
          type: 'circle'
        },
        opacity: {
          value: 0.5,
          random: true,
          anim: {
            enable: true,
            speed: 1,
            opacity_min: 0.1,
            sync: false
          }
        },
        size: {
          value: 5,
          random: true,
          anim: {
            enable: true,
            speed: 2,
            size_min: 0.1,
            sync: false
          }
        },
        line_linked: {
          enable: true,
          distance: 150,
          color: '#fff',
          opacity: 0.4,
          width: 1
        }
      },
      interactivity: {
        detectsOn: 'canvas',
        events: {
          onHover: {
            enable: true,
            mode: 'repulse'
          },
          onClick: {
            enable: true,
            mode: 'attract'
          },
          onDrag: {
            enable: true,
            mode: 'attract'
          }
        },
        modes: {
          grab: {
            distance: 400,
            line_linked: {
              opacity: 1
            }
          },
          repulse: {
            distance: 200,
            duration: 0.4
          },
          attract: {
            distance: 200,
            duration: 0.4,
            forceAttract: 0.3,
            maxSpeed: 2
          }
        }
      },
      motion: {
        random: true,
        tilt: {
          enable: true,
          axis: 'x',
          strength: 0.1
        }
      },
      interactivity_modules: [
        TSParticles.InteractivityModuleAttract,
        TSParticles.InteractivityModuleRepulse,
        TSParticles.InteractivityModuleGrab
      ],
      modules: [
        TSParticles.ModuleInteractivity2
      ]
    });

    particles.add(true);
  </script>
</body>
</html>
Copied!
Copied!

All versions