25 lines
771 B
JavaScript
25 lines
771 B
JavaScript
import { BackgroundMaskCover } from "./BackgroundMaskCover";
|
|
export class BackgroundMask {
|
|
constructor() {
|
|
this.composite = "destination-out";
|
|
this.cover = new BackgroundMaskCover();
|
|
this.enable = false;
|
|
}
|
|
load(data) {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
if (data.composite !== undefined) {
|
|
this.composite = data.composite;
|
|
}
|
|
if (data.cover !== undefined) {
|
|
const cover = data.cover;
|
|
const color = (typeof data.cover === "string" ? { color: data.cover } : data.cover);
|
|
this.cover.load(cover.color !== undefined ? cover : { color: color });
|
|
}
|
|
if (data.enable !== undefined) {
|
|
this.enable = data.enable;
|
|
}
|
|
}
|
|
}
|