Get started with tsparticles-preset-triangles CDN

MIT licensed

Tsparticles-preset-triangles is a library for creating triangular particle effects in WebGL.

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-preset-triangles CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with tsparticles-preset-triangles CDN - cdnhub.io</title>
  <style>
    body { margin: 0; }
    canvas { width: 100%; height: 100vh; }
  </style>
</head>
<body>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/worksans.min.css"></script>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/tsparticles.min.js"></script>
  <script src="https://cdn.cdnhub.io/tsparticles-preset-triangles/2.12.0/tsparticles.preset.triangles.min.js"></script>

  <script>
    const particlesContainer = document.createElement('div');
    particlesContainer.id = 'tsparticles';
    document.body.appendChild(particlesContainer);

    const particlesInit = async () => {
      await tsparticles.load('tsparticles', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/parts/triangle.min.js');

      const particleSystem = new tsparticles.Triangle({
        id: 'tsparticles',
        container: particlesContainer,
        width: window.innerWidth,
        height: window.innerHeight,
        particles: {
          number: {
            value: 100,
            density: {
              enable: true,
              value_area: 800
            }
          },
          color: {
            value: '#ffffff'
          },
          shape: {
            type: 'triangle'
          },
          size: {
            value: 5,
            random: true,
            anim: {
              enable: false,
              speed: 1,
              size_min: 0.1,
              sync: false
            }
          },
          opacity: {
            value: 0.5,
            random: true,
            anim: {
              enable: false,
              speed: 1,
              opacity_min: 0.1
            }
          },
          move: {
            enable: true,
            speed: 1,
            direction: 'none',
            random: true,
            straight: false,
            out_mode: 'out'
          },
          link: {
            enable: false
          },
          interact: {
            detectsOn: 'canvas',
            modes: {
              grab: {
                distance: 400,
                maxDistance: 500
              },
              repulse: {
                distance: 200,
                duration: 0.4
              },
              push: {
                particles_nb: 1
              },
              trail: {
                enable: false,
                length: 0.5,
                color: '#000000'
              }
            }
          },
          clipDetect: false
        },
        interact: {
          detectsOn: 'canvas',
          modes: {
            grab: {
              distance: 400,
              maxDistance: 500
            },
            repulse: {
              distance: 200,
              duration: 0.4
            },
            push: {
              particles_nb: 1
            },
            trail: {
              enable: false,
              length: 0.5,
              color: '#000000'
            }
          }
        },
        fpsLimit: 60,
        interactable: true
      });
    };

    particlesInit();

    window.addEventListener('resize', () => {
      particlesSystem.resize();
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions