import { Container, Graphics, NineSliceSprite as PixiNineSliceSprite, Optional, Size, Sprite } from 'pixi.js';
import { type GetViewSettings } from './utils/helpers/view';
type FillPaddings = {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
export type ProgressBarViewType = GetViewSettings;
export type NineSliceSprite = {
bg: [number, number, number, number];
fill: [number, number, number, number];
};
export type ProgressBarOptions = {
bg: ProgressBarViewType;
fill: ProgressBarViewType;
fillPaddings?: FillPaddings;
nineSliceSprite?: NineSliceSprite;
progress?: number;
};
/**
* Creates a ProgressBar.
* @example
* new ProgressBar({
* bg: 'slider_bg.png',
* fill: 'slider.png',
* progress: 50,
* });
*/
export declare class ProgressBar extends Container {
protected bg: Sprite | PixiNineSliceSprite | Graphics;
protected fill: Sprite | PixiNineSliceSprite | Graphics;
protected fillMask: PixiNineSliceSprite | Graphics;
protected progressStart: number;
protected _progress: number;
protected options: ProgressBarOptions;
/** Container, that holds all inner views. */
innerView: Container;
/**
* Creates a ProgressBar.
* @param options - Options.
* @param { Sprite | Graphics | Texture | string } options.bg - Background of the ProgressBar.
*
If you pass a string, it will be used as a texture name.
*
If you want to use NineSliceSprite, you have to pass a text
* (name of texture) or an instance of Texture as a parameter here.
* @param { Sprite | Graphics | Texture | string } options.fill - Fill of the ProgressBar.
*
If you pass a string, it will be used as a texture name.
*
If you want to use NineSliceSprite, you have to pass a text
* (name of texture) or an instance of Texture as a parameter here.
* @param { FillPaddings } options.fillPaddings - Fill offsets.
* @param { number } options.fillPaddings.top - Fill top offset.
* @param { number } options.fillPaddings.right - Fill right offset.
* @param { number } options.fillPaddings.bottom - Fill bottom offset.
* @param { number } options.fillPaddings.left - Fill left offset.
* @param { NineSliceSprite } options.nineSliceSprite - NineSliceSprite values for bg and fill.
* @param { Array } options.nineSliceSprite.bg - NineSliceSprite config for bg ([number, number, number, number]).
*
!!! IMPORTANT: To make it work, you have to pass a bg parameter as texture name or texture instance.
* @param { Array } options.nineSliceSprite.fill - NineSliceSprite config fill ([number, number, number, number]).
*
!!! IMPORTANT: To make it work, you have to pass a fill parameter as texture name or texture instance.
* @param { number } options.progress - Initial progress value.
*/
constructor(options?: ProgressBarOptions);
/**
* Initialize ProgressBar.
* @param root0
* @param root0.bg - Background texture.
* @param root0.fill - Fill texture.
* @param root0.fillPaddings - Fill offset.
* @param root0.progress - Initial progress value.
*/
init({ bg, fill, fillPaddings, progress }: ProgressBarOptions): void;
/**
* Set bg.
* @param bg
*/
setBackground(bg: ProgressBarViewType): void;
/**
* Set fill.
* @param fill
* @param fillPadding
*/
setFill(fill: ProgressBarViewType, fillPadding?: FillPaddings): void;
protected validate(progress: number): number;
/** Set current progress percentage value. */
set progress(progress: number);
/** Return current progress percentage value. */
get progress(): number;
/**
* Sets width of a ProgressBars background and fill.
* If nineSliceSprite is set, then width will be set to nineSliceSprite.
* If nineSliceSprite is not set, then width will control components width as Container.
* @param width - Width value.
*/
set width(width: number);
/** Gets width of a ProgressBar. */
get width(): number;
/**
* Sets height of a ProgressBars background and fill.
* If nineSliceSprite is set, then height will be set to nineSliceSprite.
* If nineSliceSprite is not set, then height will control components height as Container.
* @param height - Height value.
*/
set height(height: number);
/** Gets height of a ProgressBar. */
get height(): number;
setSize(value: number | Optional, height?: number): void;
}
export {};
//# sourceMappingURL=ProgressBar.d.ts.map