Get started with tsparticles-path-svg CDN

MIT licensed

TSParticles-path-svg: Create custom SVG particle paths in Three.js TSParticles.

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-path-svg CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with tsparticles-path-svg CDN - cdnhub.io</title>
  <style>
    #tsparticles {
      height: 100vh;
      width: 100%;
    }
  </style>
</head>
<body>
  <div id="tsparticles"></div>
  <script src="https://cdn.jsdelivr.net/npm/worksans@4.2.0/worksans.css"></script>
  <script src="https://cdn.jsdelivr.net/npm/@tsparticles/core@5.1.2/base/tsparticles.min.js"></script>
  <script src="https://cdn.cdnhub.io/tsparticles-path-svg/2.12.0/tsparticles.path.svg.min.js"></script>
  <script>
    const particlesInit = async (main) => {
      await particles.load('tsparticles', main);

      const particlesContainer = document.querySelector('#tsparticles');

      particles.add(
        'tsparticles',
        {
          numParticles: {
            value: 50,
            density: {
              enable: true,
              value_area: 800
            }
          },
          shape: {
            type: 'pathSVG',
            options: {
              path: particlesContainer.querySelector('#path'),
              color: '#fff'
            }
          },
          size: {
            value: 5,
            random: true,
            anim: {
              enable: false,
              speed: 4,
              size_min: 0.1,
              sync: false
            }
          },
          opacity: {
            value: 0.5,
            random: true,
            anim: {
              enable: false,
              speed: 1,
              opacity_min: 0.1,
              sync: false
            }
          },
          move: {
            enable: true,
            speed: 1,
            direction: 'none',
            random: true,
            straight: false,
            out_mode: 'out'
          },
          interact: {
            detectsOn: 'canvas',
            modes: {
              grab: {
                distance: 400,
                maxDistance: 500
              },
              repulse: {
                distance: 200,
                duration: 0.4
              },
              push: {
                particles_nb: 4
              },
              remove: {
                quantity: 1
              }
            }
          },
          custom: {
            svg_path: particlesContainer.querySelector('#path')
          },
          particles: []
        }
      );
    };

    document.addEventListener('DOMContentLoaded', (event) => {
      particlesInit(document.querySelector('#tsparticles'));
    });
  </script>
  <svg id="path" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
    <path d="M50,10 C20,50 80,50 50,90 C20,90 80,90 50,10 Z" stroke-width="5" stroke="black" fill="none" />
  </svg>
</body>
</html>
Copied!
Copied!

All versions