UNPKG

@drincs/pixi-vn

Version:

Pixi'VN is a npm package that provides various features for creating visual novels.

102 lines (99 loc) 4.02 kB
import * as pixi_js from 'pixi.js'; import { Texture, PointData, ObservablePoint } from 'pixi.js'; import { ImageContainerOptions } from '../../interface/canvas/canvas-options.js'; import ImageSprite from './ImageSprite.js'; import Container from './Container.js'; import ImageContainerMemory from '../../interface/canvas/memory/ImageContainerMemory.js'; import AdditionalPositionsExtension from './AdditionalPositions.js'; import AnchorExtension from './AnchorExtension.js'; import '../../types/ContainerChild.js'; import './CanvasBaseItem.js'; import '../../interface/canvas/memory/CanvasBaseItemMemory.js'; import './Sprite.js'; import '../../types/CanvasEventNamesType.js'; import '../CanvasEvent.js'; import '../../types/EventIdType.js'; import '../../interface/canvas/memory/SpriteMemory.js'; import '../../interface/canvas/TextureMemory.js'; import '../../interface/canvas/memory/ImageSpriteMemory.js'; import '../../interface/canvas/memory/ContainerMemory.js'; /** * This class is a extension of the {@link Container}, it has the same properties and methods, * but this container is composed only of {@link ImageSprite} and introduces the {@link ImageContainer.load} functionality * @example * ```typescript * const liamBodyImageUrl = 'https://example.com/assets/liam/body.png'; * const liamHeadImageUrl = 'https://example.com/assets/liam/head.png'; * const container = new ImageContainer(undefined, [liamBodyImageUrl, liamHeadImageUrl]); * await container.load() * canvas.add(container); * ``` */ declare class ImageContainer extends Container<ImageSprite, ImageContainerMemory> implements AnchorExtension, AdditionalPositionsExtension { constructor(options?: ImageContainerOptions<ImageSprite>, textureAliases?: string[]); get memory(): ImageContainerMemory; set memory(_value: ImageContainerMemory); setMemory(value: ImageContainerMemory): Promise<void>; pixivnId: string; private _loadIsStarted; get loadIsStarted(): boolean; /** * Load the children images. * @returns A promise that resolves when the images are loaded. */ load(): Promise<void>; /** * The texture of the first child. * If there is no child, it returns a new {@link Texture}. */ get texture(): Texture<pixi_js.TextureSource<any>>; /** * Check if there is a child with the empty texture. * @returns A boolean that is true if there is a child with the empty texture. */ get haveEmptyTexture(): boolean; /** Anchor */ private _anchor?; get anchor(): PointData; set anchor(value: PointData | number); private reloadAnchor; get pivot(): ObservablePoint; set pivot(value: ObservablePoint); /** AdditionalPositions */ private _align; set align(value: Partial<PointData> | number); get align(): Partial<PointData> | number; set xAlign(value: number); get xAlign(): number; set yAlign(value: number); get yAlign(): number; private _percentagePosition; set percentagePosition(value: Partial<PointData> | number); get percentagePosition(): Partial<PointData> | number; set xPercentagePosition(_value: number); get xPercentagePosition(): number; set yPercentagePosition(_value: number); get yPercentagePosition(): number; get positionType(): "pixel" | "percentage" | "align"; get positionInfo(): { x: number; y: number; type: "pixel" | "percentage" | "align"; }; set positionInfo(value: { x: number; y: number; type?: "pixel" | "percentage" | "align"; }); private reloadPosition; get position(): ObservablePoint; set position(value: ObservablePoint); get x(): number; set x(value: number); get y(): number; set y(value: number); } declare function setMemoryImageContainer(element: ImageContainer, memory: ImageContainerOptions | {}, opstions?: { ignoreScale?: boolean; }): Promise<void>; export { ImageContainer as default, setMemoryImageContainer };