28 lines
824 B
JavaScript
28 lines
824 B
JavaScript
import { deepExtend, executeOnSingleOrMultiple } from "tsparticles-engine";
|
|
import { SplitFactor } from "./SplitFactor";
|
|
import { SplitRate } from "./SplitRate";
|
|
export class Split {
|
|
constructor() {
|
|
this.count = 1;
|
|
this.factor = new SplitFactor();
|
|
this.rate = new SplitRate();
|
|
this.sizeOffset = true;
|
|
}
|
|
load(data) {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
if (data.count !== undefined) {
|
|
this.count = data.count;
|
|
}
|
|
this.factor.load(data.factor);
|
|
this.rate.load(data.rate);
|
|
this.particles = executeOnSingleOrMultiple(data.particles, (particles) => {
|
|
return deepExtend({}, particles);
|
|
});
|
|
if (data.sizeOffset !== undefined) {
|
|
this.sizeOffset = data.sizeOffset;
|
|
}
|
|
}
|
|
}
|