tsparticles-preset-links
    TypeScript icon, indicating that this package has built-in type declarations

    1.18.2 • Public • Published

    banner

    tsParticles Links Preset

    jsDelivr npmjs npmjs

    tsParticles preset for creating a particles web created by link lines between them.

    Sample

    demo

    How to use it

    CDN / Vanilla JS / jQuery

    The first step is installing tsParticles following the instructions for vanilla javascript in the main project here

    Once installed you need one more script to be included in your page (or you can download that from jsDelivr:

    <script src="https://cdn.jsdelivr.net/npm/tsparticles"></script>
    <script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-links"></script>

    This script MUST be placed after the tsParticles one.

    Bundle

    A bundled script can also be used, this will include every needed plugin needed by the preset.

    <script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-links/dist/tsparticles.preset.links.bundle.min.js"></script>

    Usage

    Once the scripts are loaded you can set up tsParticles like this:

    loadFirePreset(tsParticles);
    
    tsParticles.load("tsparticles", {
      preset: "links",
    });

    Customization

    Important ⚠️ You can override all the options defining the properties like in any standard tsParticles installation.

    tsParticles.load("tsparticles", {
      particles: {
        shape: {
          type: "square",
        },
      },
      preset: "links",
    });

    Like in the sample above, the circles will be replaced by squares.

    React.js / Preact / Inferno

    The syntax for React.js, Preact and Inferno is the same.

    This sample uses the class component syntax, but you can use hooks as well (if the library supports it).

    import Particles from "react-tsparticles";
    import { Main } from "tsparticles";
    import { loadFirePreset } from "tsparticles-preset-links";
    
    export class ParticlesContainer extends React.PureComponent<IProps> {
      // this customizes the component tsParticles installation
      customInit(main: Main) {
        // this adds the preset to tsParticles, you can safely use the
        loadFirePreset(main);
      }
    
      render() {
        const options = {
          preset: "links",
        };
    
        return <Particles options={options} init={this.customInit} />;
      }
    }

    Vue (2.x and 3.x)

    The syntax for Vue.js 2.x and 3.x is the same

    <Particles id="tsparticles" :particlesInit="particlesInit" url="http://foo.bar/particles.json" />
    function particlesInit(main: Main) {
      loadFirePreset(main);
    }

    Angular

    <ng-particles
      [id]="id"
      [options]="particlesOptions"
      (particlesLoaded)="particlesLoaded($event)"
      (particlesInit)="particlesInit($event)"
    ></ng-particles>
    function particlesInit(main: Main): void {
      loadFirePreset(main);
    }

    Svelte

    
    <Particles
            id="tsparticles"
            url="http://foo.bar/particles.json"
            on:particlesInit="{onParticlesInit}"
    />
    
    let onParticlesInit = (main) => {
      loadFirePreset(main);
    };

    Install

    npm i tsparticles-preset-links

    DownloadsWeekly Downloads

    157

    Version

    1.18.2

    License

    MIT

    Unpacked Size

    1.02 MB

    Total Files

    13

    Last publish

    Collaborators

    • avatar