tsparticles
Version:
Porting of the abandoned Vincent Garreau's particles.js, converted in TypeScript. Added many new cool features and various bug fixes.
36 lines (35 loc) • 1.05 kB
JavaScript
import { OpacityAnimation } from "./OpacityAnimation";
import { RandomOpacity } from "./RandomOpacity";
export class Opacity {
constructor() {
this.animation = new OpacityAnimation();
this.random = new RandomOpacity();
this.value = 1;
}
get anim() {
return this.animation;
}
set anim(value) {
this.animation = value;
}
load(data) {
var _a;
if (data !== undefined) {
const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
if (animation !== undefined) {
this.animation.load(animation);
}
if (data.random !== undefined) {
if (typeof data.random === "boolean") {
this.random.enable = data.random;
}
else {
this.random.load(data.random);
}
}
if (data.value !== undefined) {
this.value = data.value;
}
}
}
}