UNPKG

2.52 kBTypeScriptView Raw
1import { Color } from '@pixi/color';
2import type { ColorSource } from '@pixi/color';
3import type { ExtensionMetadata } from '@pixi/extensions';
4import type { ISystem } from '../system/ISystem';
5export interface BackgroundSytemOptions {
6 /**
7 * The background color used to clear the canvas. See {@link PIXI.ColorSource} for accepted color values.
8 * @memberof PIXI.IRendererOptions
9 */
10 backgroundColor: ColorSource;
11 /**
12 * Alias for {@link PIXI.IRendererOptions.backgroundColor}
13 * @memberof PIXI.IRendererOptions
14 */
15 background?: ColorSource;
16 /**
17 * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).
18 * @memberof PIXI.IRendererOptions
19 */
20 backgroundAlpha: number;
21 /**
22 * Whether to clear the canvas before new render passes.
23 * @memberof PIXI.IRendererOptions
24 */
25 clearBeforeRender: boolean;
26}
27/**
28 * The background system manages the background color and alpha of the main view.
29 * @memberof PIXI
30 */
31export declare class BackgroundSystem implements ISystem<BackgroundSytemOptions> {
32 static defaultOptions: BackgroundSytemOptions;
33 /** @ignore */
34 static extension: ExtensionMetadata;
35 /**
36 * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
37 * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every
38 * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect
39 * to clear the canvas every frame. Disable this by setting this to false. For example, if
40 * your game has a canvas filling background image you often don't need this set.
41 * @member {boolean}
42 * @default
43 */
44 clearBeforeRender: boolean;
45 /** Reference to the internal color */
46 private _backgroundColor;
47 constructor();
48 /**
49 * initiates the background system
50 * @param {PIXI.IRendererOptions} options - the options for the background colors
51 */
52 init(options: BackgroundSytemOptions): void;
53 /**
54 * The background color to fill if not transparent.
55 * @member {PIXI.ColorSource}
56 */
57 get color(): ColorSource;
58 set color(value: ColorSource);
59 /**
60 * The background color alpha. Setting this to 0 will make the canvas transparent.
61 * @member {number}
62 */
63 get alpha(): number;
64 set alpha(value: number);
65 /** The background color object. */
66 get backgroundColor(): Color;
67 destroy(): void;
68}