Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tsparticles-preset-links

tsparticles5.6kMITdeprecated2.12.0TypeScript support: included

@tsparticles/preset-links is the new package, please use that

tsParticles links preset

front-end, frontend, 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, canvas, fireworks, fireworks-js, confetti-js, confettijs, fireworksjs, canvas-confetti, tsparticles-preset

readme

banner

tsParticles Links Preset

jsDelivr npmjs npmjs GitHub Sponsors

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

Slack Discord Telegram

tsParticles Product Hunt

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-engine@2/tsparticles.engine.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-interaction-particles-links@2/tsparticles.interaction.particles.links.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-color@2/tsparticles.updater.color.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-size@2/tsparticles.updater.size.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-links@2/tsparticles.preset.links.min.js"></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@2/tsparticles.preset.links.min.js"></script>

Usage

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

(async () => {
  await loadLinksPreset(tsParticles); // this is required only if you are not using the bundle script

  await 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", // starting from v2, this require the square shape script
    },
  },
  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).

`typescript jsx import Particles from "react-particles"; import type { Engine } from "tsparticles-engine"; import { loadLinksPreset } from "tsparticles-preset-links";

export class ParticlesContainer extends React.PureComponent<IProps> { // this customizes the component tsParticles installation async customInit(engine: Engine): Promise<void> { // this adds the preset to tsParticles, you can safely use the await loadLinksPreset(engine); }

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_

```vue
<Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
const particlesOptions = {
  preset: "links",
};

async function particlesInit(engine: Engine): Promise<void> {
  await loadLinksPreset(engine);
}

Angular

<ng-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></ng-particles>
const particlesOptions = {
  preset: "links",
};

async function particlesInit(engine: Engine): Promise<void> {
  await loadLinksPreset(engine);
}

Svelte


<Particles
        id="tsparticles"
        options={particlesOptions}
        particlesInit={particlesInit}
/>
let particlesOptions = {
  preset: "links",
};

let particlesInit = async (engine) => {
  await loadLinksPreset(engine);
};
flowchart TD

subgraph i [Interactions]

subgraph ip [Particles]
ipl[Links]
end

end

i --> ip

e[tsParticles Engine] --> i

subgraph m [Movers]
mb[Base]
end

e --> m

subgraph s [Shapes]
sc[Circle]
end

e --> s

subgraph u [Updaters]
uc[Color]
uop[Opacity]
uou[Out Modes]
usi[Size]
end

e --> u

subgraph pr [Presets]
prl[Links]
end

e --> pr

ipl & mb & sc & uc & uop & uou & usi --> prl

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

2.12.0 (2023-08-04)

Features

  • added hyperscape preset (5e07a70)

2.11.0 (2023-07-13)

Note: Version bump only for package tsparticles-presets-workspace

2.10.1 (2023-06-04)

Note: Version bump only for package tsparticles-presets-workspace

2.10.0 (2023-06-03)

Bug Fixes

  • deps: update dependency typedoc-plugin-missing-exports to v2 (6105b14)