UNPKG

1.35 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var color = require('@pixi/color');
6var extensions = require('@pixi/extensions');
7
8class BackgroundSystem {
9 constructor() {
10 this.clearBeforeRender = true;
11 this._backgroundColor = new color.Color(0);
12 this.alpha = 1;
13 }
14 init(options) {
15 this.clearBeforeRender = options.clearBeforeRender;
16 const { backgroundColor, background, backgroundAlpha } = options;
17 const color = background ?? backgroundColor;
18 if (color !== void 0) {
19 this.color = color;
20 }
21 this.alpha = backgroundAlpha;
22 }
23 get color() {
24 return this._backgroundColor.value;
25 }
26 set color(value) {
27 this._backgroundColor.setValue(value);
28 }
29 get alpha() {
30 return this._backgroundColor.alpha;
31 }
32 set alpha(value) {
33 this._backgroundColor.setAlpha(value);
34 }
35 get backgroundColor() {
36 return this._backgroundColor;
37 }
38 destroy() {
39 }
40}
41BackgroundSystem.defaultOptions = {
42 backgroundAlpha: 1,
43 backgroundColor: 0,
44 clearBeforeRender: true
45};
46BackgroundSystem.extension = {
47 type: [
48 extensions.ExtensionType.RendererSystem,
49 extensions.ExtensionType.CanvasRendererSystem
50 ],
51 name: "background"
52};
53extensions.extensions.add(BackgroundSystem);
54
55exports.BackgroundSystem = BackgroundSystem;
56//# sourceMappingURL=BackgroundSystem.js.map