tsparticles
Version:
Porting of the abandoned Vincent Garreau's particles.js, converted in TypeScript. Added many new cool features and various bug fixes.
34 lines (33 loc) • 1.03 kB
JavaScript
import { Color } from "../Particles/Color";
export class Background {
load(data) {
if (data !== undefined) {
if (data.color !== undefined) {
if (this.color === undefined) {
this.color = new Color();
}
if (typeof data.color === "string") {
this.color.value = data.color;
}
else {
this.color.load(data.color);
}
}
if (data.image !== undefined) {
this.image = data.image;
}
if (data.position !== undefined) {
this.position = data.position;
}
if (data.repeat !== undefined) {
this.repeat = data.repeat;
}
if (data.size !== undefined) {
this.size = data.size;
}
if (data.opacity !== undefined) {
this.opacity = data.opacity;
}
}
}
}