@tsparticles/interaction-particles-links
Version:
tsParticles links particles interaction
55 lines (54 loc) • 1.63 kB
JavaScript
import { OptionsColor, isNull } from "@tsparticles/engine";
import { LinksShadow } from "./LinksShadow.js";
import { LinksTriangle } from "./LinksTriangle.js";
export class Links {
constructor() {
this.blink = false;
this.color = new OptionsColor();
this.color.value = "#fff";
this.consent = false;
this.distance = 100;
this.enable = false;
this.frequency = 1;
this.opacity = 1;
this.shadow = new LinksShadow();
this.triangles = new LinksTriangle();
this.width = 1;
this.warp = false;
}
load(data) {
if (isNull(data)) {
return;
}
if (data.id !== undefined) {
this.id = data.id;
}
if (data.blink !== undefined) {
this.blink = data.blink;
}
this.color = OptionsColor.create(this.color, data.color);
if (data.consent !== undefined) {
this.consent = data.consent;
}
if (data.distance !== undefined) {
this.distance = data.distance;
}
if (data.enable !== undefined) {
this.enable = data.enable;
}
if (data.frequency !== undefined) {
this.frequency = data.frequency;
}
if (data.opacity !== undefined) {
this.opacity = data.opacity;
}
this.shadow.load(data.shadow);
this.triangles.load(data.triangles);
if (data.width !== undefined) {
this.width = data.width;
}
if (data.warp !== undefined) {
this.warp = data.warp;
}
}
}