2023-02-17 11:06:01 +01:00

35 lines
1.0 KiB
JavaScript

import { OptionsColor, executeOnSingleOrMultiple } from "tsparticles-engine";
export class BubbleBase {
constructor() {
this.distance = 200;
this.duration = 0.4;
this.mix = false;
}
load(data) {
if (!data) {
return;
}
if (data.distance !== undefined) {
this.distance = data.distance;
}
if (data.duration !== undefined) {
this.duration = data.duration;
}
if (data.mix !== undefined) {
this.mix = data.mix;
}
if (data.opacity !== undefined) {
this.opacity = data.opacity;
}
if (data.color !== undefined) {
const sourceColor = this.color instanceof Array ? undefined : this.color;
this.color = executeOnSingleOrMultiple(data.color, (color) => {
return OptionsColor.create(sourceColor, color);
});
}
if (data.size !== undefined) {
this.size = data.size;
}
}
}