import * as _drincs_pixi_vn_pixi_js from '@drincs/pixi-vn/pixi.js'; import _drincs_pixi_vn_pixi_js__default, { Container as Container$1, ContainerChild, Ticker, UPDATE_PRIORITY as UPDATE_PRIORITY$1, Application, Rectangle as Rectangle$1, ApplicationOptions, PointData, ContainerOptions as ContainerOptions$1, SpriteOptions as SpriteOptions$1, CanvasTextOptions, Texture as Texture$1, TextureSourceLike, ContainerEvents, EventEmitter, ObservablePoint, TextureSource, TextOptions as TextOptions$1 } from '@drincs/pixi-vn/pixi.js'; export { TextureSourceLike, Ticker as TickerValue } from '@drincs/pixi-vn/pixi.js'; import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion'; import { Devtools } from '@pixi/devtools'; import { T as TickerArgs, a as Ticker$1, C as CanvasBaseItemMemory, b as CanvasBaseItem, c as TickerInfo, d as TickersSequence, e as CanvasGameState, f as ContainerChild$1, A as AdditionalPositionsExtensionProps, L as ListenerExtensionMemory, g as ListenerExtension, h as AdditionalPositionsExtension, O as OnEventsHandlers, i as ContainerMemory, j as TickerHistory } from './ContainerMemory-BpDgacyr.js'; export { k as addListenerHandler, l as analizePositionsExtensionProps } from './ContainerMemory-BpDgacyr.js'; export { AnimationOptions as MotionAnimationOptions } from 'motion'; import { OnErrorHandler } from '@drincs/pixi-vn/core'; type Layer = Container$1; type TickerValue = Ticker; /** * A class is used to create a ticker element to add into a Pixi Application. * You can use {@link canvas.tickers.add()} to add this element into the application. * This class should be extended and the fn method should be overridden. * You must use the {@link tickerDecorator} to register the ticker in the game. * In Ren'Py is a transform. * @template TArgs The type of the arguments that you want to pass to the ticker. * @example * ```ts * \@tickerDecorator() // this is equivalent to tickerDecorator("RotateTicker") * export class RotateTicker extends TickerBase<{ speed?: number }> { * override fn( * t: TickerValue, // the ticker that is calling this method * args: { // the arguments that you passed when you added the ticker * speed?: number, * }, * aliases: string[], // the aliases of the canvas elements that are connected to this ticker * tickerId: string, // the id of the ticker. You can use this to get the ticker from the canvas.tickers.currentTickers * ): void { * let speed = args.speed === undefined ? 0.1 : args.speed * aliases.forEach((alias) => { * let element = canvas.find(alias) * if (element && element instanceof Container) { * if (clockwise) * element.rotation += speed * t.deltaTime * else * element.rotation -= speed * t.deltaTime * } * }) * } * } * ``` */ declare abstract class TickerBase implements Ticker$1 { /** * @param args The arguments that you want to pass to the ticker. * @param options The options of the ticker. */ constructor(args: TArgs, options?: { /** * The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish). @default undefined */ duration?: number; /** * The priority of the ticker. @default UPDATE_PRIORITY.NORMAL */ priority?: UPDATE_PRIORITY$1; /** * The id of the ticker. This param is used by the system when will ber restoring the tickers from a save. If not provided, a random id will be generated. @default undefined */ id?: string; /** * The aliases of the canvas elements that are connected to this ticker. This is used by the system to know which canvas elements are connected to this ticker, and to pass them to the fn method. @default [] */ canvasElementAliases?: string[]; }); readonly alias: string; readonly id: string; args: TArgs; duration?: number; priority?: UPDATE_PRIORITY$1; protected ticker: _drincs_pixi_vn_pixi_js.Ticker; canvasElementAliases: string[]; private generateTickerId; /** * The method that will be called every frame. * This method should be overridden and you can use {@link canvas.add()} to get the canvas element of the canvas, and edit them. * @param _ticker The ticker that is calling this method * @param _args The arguments that you passed when you added the ticker * @param _alias The alias of the canvas elements that are connected to this ticker * @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link canvas.tickers.currentTickers} */ abstract fn(_ticker: TickerValue, _args: TArgs, _alias: string | string[], _tickerId: string): void; protected fnValue?: () => void; complete(_options?: { ignoreTickerSteps?: boolean; }): void; stop(): void; start(): void; pause(): void; play(): void; get paused(): boolean; } /** * Is a decorator that register a ticker in the game. * Is a required decorator for use the ticker in the game. * Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game. * @param name is th identifier of the label, by default is the name of the class * @returns */ declare function tickerDecorator(name?: string): (target: { new (args: any, options?: { duration?: number; priority?: UPDATE_PRIORITY$1; id?: string; canvasElementAliases?: string[]; }): Ticker$1; }) => void; declare namespace RegisteredTickers { /** * Register a ticker in the game. * @param target The class of the ticker. * @param name Name of the ticker, by default it will use the class name. If the name is already registered, it will show a warning */ function add(target: { new (args: any, options?: { duration?: number; priority?: UPDATE_PRIORITY$1; id?: string; canvasElementAliases?: string[]; }): Ticker$1; }, name?: string): void; /** * Get a ticker by the id. * @param canvasId The id of the ticker. * @returns The ticker type. */ function get>(tickerId: string): T | undefined; /** * Get a ticker instance by the id. * @param tickerId The id of the ticker. * @param args The arguments that you want to pass to the ticker. * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame. * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL. * @returns The instance of the ticker */ function getInstance(tickerId: string, args: TArgs, options?: { duration?: number; priority?: UPDATE_PRIORITY$1; id?: string; canvasElementAliases?: string[]; }): Ticker$1 | undefined; /** * Get a list of all tickers registered. * @returns An array of tickers. */ function values(): { new (args: any, options?: { duration?: number; priority?: UPDATE_PRIORITY$1; id?: string; canvasElementAliases?: string[]; }): Ticker$1; }[]; /** * Check if a ticker is registered. * @param id The id of the ticker. * @returns True if the ticker is registered, false otherwise. */ function has(id: string): boolean; /** * Get a list of all ticker ids registered. * @returns An array of label ids. */ function keys(): string[]; } type TickerProgrationType = TickerProgrationLinear | TickerProgrationExponential; interface TickerProgrationLinear { /** * The amount of the speed to increase every frame. */ amt: number; /** * The limit of the effect */ limit?: number; type: "linear"; } interface TickerProgrationExponential { /** * The percentage of the speed to increase every frame. if the percentage is 0.1, the speed will increase by 10% every frame. */ percentage: number; /** * The limit of the effect */ limit?: number; type: "exponential"; } interface TickerTimeoutHistory { aliases: string[]; ticker: string; canBeDeletedBeforeEnd: boolean; } type CommonTickerProps = { /** * An array of strings containing the aliases of the canvas components to remove after the animation completes. * @default [] */ aliasToRemoveAfter?: string[] | string; /** * If true, the effect only starts if the canvas element have a texture * @default false */ startOnlyIfHaveTexture?: boolean; /** * If you want to resume tickers that were previously paused, provide the aliases of the canvas components whose tickers should be resumed. * @default [] */ tickerAliasToResume?: string[] | string; /** * A string containing the ticker ID to resume after the animation completes. * @default [] */ tickerIdToResume?: string[] | string; /** * A boolean indicating whether the animation must complete before the next `step` of the game. If `true`, the game will force the animation to finish before proceeding. * When true, calling {@link narration.continue()} forces the current content to complete before advancing to the next narrative step. * @default false */ completeOnContinue?: boolean; }; interface CanvasBaseInterface extends CanvasBaseItem, Container$1 { } interface CanvasHtmlLayersInterface { /** * Add a HTML layer to the canvas. * @param id The id of the layer. * @param element The html element to be added. * @param style The style of the layer. @default { position: "absolute", pointerEvents: "none", userSelect: "none" }. * @example * ```tsx * const root = document.getElementById('root') * if (!root) { * throw new Error('root element not found') * } * const htmlLayer = canvas.htmlLayers.add("ui", root, { * position: "absolute", * pointerEvents: "none" * }) * const reactRoot = createRoot(htmlLayer) * reactRoot.render( * * ) * ``` */ add(id: string, element: HTMLElement, style?: Partial>): HTMLDivElement; /** * Get a HTML layer from the canvas. * @param id The id of the layer. */ get(id: string): HTMLElement | undefined; /** * Remove a HTML layer from the canvas. * @param id The id of the layer to be removed. */ remove(id: string): void; } interface CanvasLayersInterface { /** * The PIXI Container that contains all the canvas elements. */ readonly gameLayer: Container$1; /** * Add a layer to the canvas. * @param label The label of the layer. * @param layer The layer to be added. * @returns The layer. * @example * ```ts * const uiLayer = new Container(); * canvas.layers.add("ui", uiLayer); * ``` */ add(label: string, layer: Container$1): Layer | undefined; /** * Get a layer from the canvas. * @param label The label of the layer. * @returns The layer. * @example * ```ts * const uiLayer = canvas.layers.get("ui"); * ``` */ get(label: string): Layer | null; /** * Remove a layer from the canvas. * @param label The label of the layer to be removed. * @example * ```ts * canvas.layers.remove("ui"); * ``` */ remove(label: string): void; } interface CanvasTickersInterface { /** * Transfer the tickers from an old alias to a new alias. * @param oldAlias Old alias * @param newAlias New alias * @param mode If "move", the old alias will be removed from the ticker. If "duplicate", the old alias will be kept in the ticker. */ transfer(oldAlias: string, newAlias: string, mode?: "move" | "duplicate"): void; /** * Currently tickers that are running. */ readonly currentTickers: Map>; /** * The steps of the tickers */ readonly currentTickersSteps: Map>; /** * Find a ticker by its id. * @param tickerId The id of the ticker to be found. * @param args The args of the ticker. * @returns The ticker if found, undefined otherwise. */ find(tickerId: string, args?: TArgs): Ticker$1 | undefined; /** * Run a ticker. You can run multiple add with the same alias and different tickerClasses. * If you run a ticker with the same alias and tickerClass, the old ticker will be removed. * If already exists a sequence of tickers with the same alias, it will be removed. * @param canvasElementAlias The alias of the canvas element that will use the ticker. * @param ticker The ticker class to be run. * @returns The id of the ticker that was added. * @example * ```ts * canvas.tickers.add("alien", new RotateTicker({ speed: 0.2 })) * ``` */ add(canvasElementAlias: string | string[], ticker: Ticker$1): string | undefined; /** * Run a sequence of tickers. * @param alias The alias of canvas element that will use the tickers. * @param steps The steps of the tickers. * @param currentStepNumber The current step number. It is used to continue the sequence of tickers. * @returns The id of tickers. * @example * ```ts * canvas.tickers.addSequence("alien", [ * new RotateTicker({ speed: 0.1, clockwise: true }, 2), // runs for 2 seconds * new RotateTicker({ speed: 0.2, clockwise: false }, 2), * ]) * ``` * @deprecated */ addSequence(alias: string, steps: Ticker$1[], currentStepNumber?: number): string | undefined; /** * Remove a connection between a canvas element and a ticker. * And remove the ticker if there is no canvas element connected to it. * @param alias The alias of the canvas element that will use the ticker. * @param ticker The ticker class to be removed. * @example * ```ts * canvas.tickers.unlinkComponent("alien", RotateTicker) * ``` */ unlinkComponent(alias: string | string[], ticker?: { new (): Ticker$1; } | string): void; /** * Remove all tickers from the canvas. */ removeAll(): void; /** * Remove a ticker by the id. * @param tickerId The id or an array of ids of the ticker to be removed. */ remove(tickerId: string | string[]): void; /** * Pause a ticker. If a paused ticker have a time to be removed, it will be removed after the time. * @param filters The filters to pause the ticker. * @returns The ids of the paused tickers. */ pause(filters: { /** * The alias of the canvas element that will use the ticker. * Will pause all tickers that are connected to this canvas element. */ canvasAlias: string; /** * Ticker ids excluded from the pause. If not provided, all tickers will be paused. */ tickerIdsExcluded?: string[]; } | { /** * The id of the ticker to be paused. If provided, only this ticker will be paused. */ id: string | string[]; }): string[]; /** * Resume a ticker. * @param filters The filters to resume the ticker. */ resume(filters: { /** * The alias of the canvas element that will use the ticker. * Will resume all tickers that are connected to this canvas element. */ canvasAlias: string; } | { /** * The id of the ticker to be resumed. If provided, only this ticker will be resumed. */ id: string | string[]; }): void; /** * Check if a ticker is paused. * @param alias The alias of the canvas element that will use the ticker. * @param tickerId The ticker that will be checked. * @returns If the ticker is paused. */ isPaused(alias: string, tickerId?: string): boolean; /** * Add a ticker that must be completed before the next step. * This method is used for example into a transition between scenes. * @param step The step that the ticker must be completed before the next step. */ completeOnStepEnd(step: { /** * The id of the step. */ id: string; /** * If is a sequence of tickers, the alias of the sequence of tickers. */ alias?: string; }): void; /** * This method force the completion of the tickers that are running. * This funcions is called in the next step. * @param id The id of the ticker. If the alias provided, the id is the id of the sequence of tickers. * @param alias The alias of the sequence of tickers. */ forceCompletion(id: string, alias?: string): Promise; onComplete(tickerId: string, options: { aliasToRemoveAfter: string[]; tickerAliasToResume: string[]; tickerIdToResume: string[]; ignoreTickerSteps?: boolean; stopTicker?: boolean; }): void; } interface CanvasManagerInterface { /** * The PIXI Application instance. * It not recommended to use this property directly. */ readonly app: Application; /** * The PIXI Container that contains all the canvas elements. * @deprecated Use {@link layers}.gameLayer instead. */ readonly gameLayer: Container$1; /** * If the manager is initialized. */ readonly isInitialized: boolean; /** * The width of the canvas. */ width: number; /** * The height of the canvas. */ height: number; /** * The screen of the canvas ({@link Application.screen}). */ readonly screen: Rectangle$1; /** * Initialize the PixiJS Application and the interface div. * This method should be called before any other method. * @param element The html element where I will put the canvas. Example: document.body * @param width The width of the canvas * @param height The height of the canvas * @param options The options of PixiJS Application * @param devtoolsOptions The options of the devtools. You can read more about it in the [PixiJS Devtools documentation](https://pixijs.io/devtools/docs/plugin/) * @example * ```ts * const body = document.body * if (!body) { * throw new Error('body element not found') * } * await canvas.init(body, { * width: 1920, * height: 1080, * backgroundColor: "#303030" * }) * ``` */ init(element: HTMLElement, options: Partial & { /** * The id of the canvas element. * @default "pixi-vn-canvas" */ id?: string; /** * The resize mode of the canvas. * @default "contain" */ resizeMode?: "contain" | "none"; }, devtoolsOptions?: Devtools): Promise; /** * The children of the canvas. */ readonly children: ContainerChild[]; /** * Copy the properties of an old canvas element to a new canvas element. * @param oldAlias Old alias * @param newAlias New alias * @param options The options of the copy. * @returns */ copyCanvasElementProperty(oldAlias: T | CanvasBaseInterface | string, newAlias: CanvasBaseInterface | string, options?: { /** * If provided, the properties returned by this function will not be copied from the old canvas element to the new canvas element. * @param defaultProperties The default properties that will be ignored. * @returns The properties that will be ignored. */ ignoreProperties?: (defaultProperties: string[]) => string[]; }): Promise; /** * Transfer the tickers from an old alias to a new alias. * @param oldAlias Old alias * @param newAlias New alias * @param mode If "move", the old alias will be removed from the ticker. If "duplicate", the old alias will be kept in the ticker. * @deprecated Use {@link tickers}.transfer instead. */ transferTickers(oldAlias: string, newAlias: string, mode?: "move" | "duplicate"): void; /** * Add a canvas element to the canvas. * If there is a canvas element with the same alias, all "style", zIndex, and {@link TickerBase} will be transferred to the new canvas element, * and the old canvas element will be removed. * @param alias The alias to identify the component. * @param canvasComponent The component to add. * @param options The options of the canvas element. * @example * ```ts * const texture = await Assets.load('https://pixijs.com/assets/bunny.png'); * const sprite = Sprite.from(texture); * canvas.add("bunny", sprite); * ``` */ add(alias: string, canvasComponent: CanvasBaseInterface, options?: { /** * If there is a canvas element with the same alias, the "style" of the old canvas element will be imported to the new canvas element. * @default false */ ignoreOldStyle?: boolean; /** * The zIndex of the canvas element. * @default undefined */ zIndex?: number; }): void; /** * Remove a canvas element from the canvas. * And remove all tickers that are not connected to any canvas element. * @param alias The alias of the canvas element to be removed. * @param options The options of the canvas element. * @returns * @example * ```ts * canvas.remove("bunny"); * ``` */ remove(alias: string | string[], options?: { /** * If true, the tickers that are connected to the canvas element will not be removed. * @default false */ ignoreTickers?: boolean; }): void; /** * Get a canvas element by the alias. * @param alias The alias to identify the component. * @returns The canvas element. If the component does not exist, it will return `undefined`. * @example * ```ts * const sprite = canvas.find("bunny"); * ``` */ find>(alias: string): T | undefined; /** * Check if a DisplayObject is on the canvas. * @param pixiElement The DisplayObject to be checked. * @returns If the DisplayObject is on the canvas. */ canvasElementIsOnCanvas(pixiElement: T): boolean; /** * Remove all canvas elements from the canvas. */ removeAll(): void; /** * Edit the alias of a canvas element. The tickers that are connected to the canvas element will be transferred. * @param oldAlias The old alias of the component to edit. * @param newAlias The new alias of the component. * @param options The options of the canvas element. */ editAlias(oldAlias: string, newAlias: string, options?: { /** * If true, the tickers that are connected to the canvas element will not be transferred. * @default false */ ignoreTickers?: boolean; }): void; /** Edit Tickers Methods */ /** * Currently tickers that are running. * @deprecated Use {@link tickers}.currentTickers instead. */ readonly currentTickers: Map>; /** * The steps of the tickers * @deprecated Use {@link tickers}.currentTickersSteps instead. */ readonly currentTickersSteps: Map>; /** * Find a ticker by its id. * @param tickerId The id of the ticker to be found. * @param args The args of the ticker. * @returns The ticker if found, undefined otherwise. * @deprecated Use {@link tickers}.find instead. */ findTicker(tickerId: string, args?: TArgs): Ticker$1 | undefined; /** * Run a ticker. You can run multiple addTicker with the same alias and different tickerClasses. * If you run a ticker with the same alias and tickerClass, the old ticker will be removed. * If already exists a sequence of tickers with the same alias, it will be removed. * @param canvasElementAlias The alias of the canvas element that will use the ticker. * @param ticker The ticker class to be run. * @returns The id of the ticker that was added. * @example * ```ts * canvas.addTicker("alien", new RotateTicker({ speed: 0.2 })) * ``` * @deprecated Use {@link tickers}.add instead. */ addTicker(canvasElementAlias: string | string[], ticker: Ticker$1): string | undefined; /** * Run a sequence of tickers. * @param alias The alias of canvas element that will use the tickers. * @param steps The steps of the tickers. * @param currentStepNumber The current step number. It is used to continue the sequence of tickers. * @returns The id of tickers. * @example * ```ts * canvas.addTickersSequence("alien", [ * new RotateTicker({ speed: 0.1, clockwise: true }, 2), // 2 seconds * new RotateTicker({ speed: 0.2, clockwise: false }, 2), * ]) * ``` * @deprecated Use {@link tickers}.addSequence instead. */ addTickersSequence(alias: string, steps: Ticker$1[], currentStepNumber?: number): string | undefined; /** * Remove a connection between a canvas element and a ticker. * And remove the ticker if there is no canvas element connected to it. * @param alias The alias of the canvas element that will use the ticker. * @param ticker The ticker class to be removed. * @example * ```ts * canvas.unlinkComponentFromTicker("alien", RotateTicker) * ``` * @deprecated Use {@link tickers}.unlinkComponent instead. */ unlinkComponentFromTicker(alias: string | string[], ticker?: { new (): Ticker$1; } | string): void; /** * Remove all tickers from the canvas. * @deprecated Use {@link tickers}.removeAll instead. */ removeAllTickers(): void; /** * Remove a ticker by the id. * @param tickerId The id or an array of ids of the ticker to be removed. * @deprecated Use {@link tickers}.remove instead. */ removeTicker(tickerId: string | string[]): void; /** * Pause a ticker. If a paused ticker have a time to be removed, it will be removed after the time. * @param filters The filters to pause the ticker. * @returns The ids of the paused tickers. * @deprecated Use {@link tickers}.pause instead. */ pauseTicker(filters: { /** * The alias of the canvas element that will use the ticker. * Will pause all tickers that are connected to this canvas element. */ canvasAlias: string; /** * Ticker ids excluded from the pause. If not provided, all tickers will be paused. */ tickerIdsExcluded?: string[]; } | { /** * The id of the ticker to be paused. If provided, only this ticker will be paused. */ id: string | string[]; }): string[]; /** * Resume a ticker. * @param filters The filters to resume the ticker. * @deprecated Use {@link tickers}.resume instead. */ resumeTicker(filters: { /** * The alias of the canvas element that will use the ticker. * Will resume all tickers that are connected to this canvas element. */ canvasAlias: string; } | { /** * The id of the ticker to be resumed. If provided, only this ticker will be resumed. */ id: string | string[]; }): void; /** * @deprecated Use {@link tickers}.isPaused instead. * Check if a ticker is paused. * @param alias The alias of the canvas element that will use the ticker. * @param tickerId The ticker that will be checked. * @returns If the ticker is paused. */ isTickerPaused(alias: string, tickerId?: string): boolean; /** * Namespace for operations on canvas tickers. */ readonly tickers: CanvasTickersInterface; /** * Pause the rendering of gameLayer and pause currently running tickers. * Use {@link resume} to restore rendering and resume only * the tickers paused by this method. */ pause(): void; /** * Resume the rendering of gameLayer and resume tickers that were paused by * {@link pause}. */ resume(): void; /** * Add a ticker that must be completed before the next step. * This method is used for example into a transition between scenes. * @param step The step that the ticker must be completed before the next step. * @deprecated Use {@link tickers}.completeOnStepEnd instead. */ completeTickerOnStepEnd(step: { /** * The id of the step. */ id: string; /** * If is a sequence of tickers, the alias of the sequence of tickers. */ alias?: string; }): void; /** * This method force the completion of the tickers that are running. * This funcions is called in the next step. * @param id The id of the ticker. If the alias provided, the id is the id of the sequence of tickers. * @param alias The alias of the sequence of tickers. * @deprecated Use {@link tickers}.forceCompletion instead. */ forceCompletionOfTicker(id: string, alias?: string): Promise; /** * Animate a Pixi’VN component or components using [motion's animate](https://motion.dev/docs/animate) function. * This function integrates with the PixiJS ticker to ensure smooth animations. * * Pixi’VN will keep track of the animation state of this function. * So Pixi’VN will save the animation state in saves. * @param components The PixiJS component(s) to animate. This can be a single component, an array of components, or a string representing the component's alias. * @param keyframes This is an object containing the properties to animate and the values to reach. * @param options [`motion` options](https://motion.dev/docs/animate#options) for the animation, including duration, `easing`, and ticker. * @param priority The priority of the PixiJS ticker. This parameter sets the ticker's priority. @default UPDATE_PRIORITY.NORMAL * @returns The function returns the ID of the ticker created to animate the component(s). * @template T The type of Pixi’VN component(s) being animated. */ animate>(components: T | string | (string | T)[], keyframes: KeyframesType, options?: AnimationOptions, priority?: UPDATE_PRIORITY$1): string | undefined; /** * Animate a Pixi’VN component or components using [motion's animate](https://motion.dev/docs/animate) function. * This function integrates with the PixiJS ticker to ensure smooth animations. * * Pixi’VN will keep track of the animation state of this function. * So Pixi’VN will save the animation state in saves. * @param components The PixiJS component(s) to animate. This can be a single component, an array of components, or a string representing the component's alias. * @param sequence The sequence of keyframes to animate the component(s) with. * @param options [`motion` options](https://motion.dev/docs/animate#options) for the animation, including duration, `easing`, and ticker. * @param priority The priority of the PixiJS ticker. This parameter sets the ticker's priority. @default UPDATE_PRIORITY.NORMAL * @returns The function returns the ID of the ticker created to animate the component(s). * @template T The type of Pixi’VN component(s) being animated. */ animate>(components: T | string, sequence: (ObjectSegment | ObjectSegmentWithTransition)[], options?: SequenceOptions, priority?: UPDATE_PRIORITY$1): string | undefined; /** * Add a layer to the canvas. * @param label The label of the layer. * @param layer The layer to be added. * @returns The layer. * @example * ```ts * const uiLayer = new Container(); * canvas.addLayer("ui", uiLayer); * ``` * @deprecated Use {@link layers}.add instead. */ addLayer(label: string, layer: Container$1): Layer | undefined; /** * Get a layer from the canvas. * @param label The label of the layer. * @returns The layer. * @example * ```ts * const uiLayer = canvas.getLayer("ui"); * ``` * @deprecated Use {@link layers}.get instead. */ getLayer(label: string): Layer | null; /** * Remove a layer from the canvas. * @param label The label of the layer to be removed. * @example * ```ts * canvas.removeLayer("ui"); * ``` * @deprecated Use {@link layers}.remove instead. */ removeLayer(label: string): void; /** * Add a HTML layer to the canvas. * @param id The id of the layer. * @param element The html element to be added. * @param style The style of the layer. @default { position: "absolute", pointerEvents: "none", userSelect: "none" }. * @example * ```tsx * const root = document.getElementById('root') * if (!root) { * throw new Error('root element not found') * } * const htmlLayer = canvas.addHtmlLayer("ui", root, { * position: "absolute", * pointerEvents: "none" * }) * const reactRoot = createRoot(htmlLayer) * reactRoot.render( * * ) * ``` * @deprecated Use {@link htmlLayers}.add instead. */ addHtmlLayer(id: string, element: HTMLElement, style?: Partial>): HTMLDivElement; /** * Get a HTML layer from the canvas. * @param id The id of the layer to be removed. * @deprecated Use {@link htmlLayers}.remove instead. */ removeHtmlLayer(id: string): void; /** * Get a HTML layer from the canvas. * @param id The id of the layer. * @deprecated Use {@link htmlLayers}.get instead. */ getHtmlLayer(id: string): HTMLElement | undefined; /** * Namespace for operations on canvas layers. */ readonly layers: CanvasLayersInterface; /** * Namespace for operations on canvas HTML layers. */ readonly htmlLayers: CanvasHtmlLayersInterface; /** * Extract the canvas as an image. * @returns The image as a base64 string. */ extractImage(): Promise; /** * Clear the canvas and the tickers. */ clear(): void; /** * Export the canvas and the tickers to an object. * @returns The object. */ export(): CanvasGameState; /** * Restore the canvas and the tickers from an object. * @param data The object. */ restore(data: object): Promise; /** * @deprecated Use {@link tickers}.onComplete instead. */ onTickerComplete(tickerId: string, options: { aliasToRemoveAfter: string[]; tickerAliasToResume: string[]; tickerIdToResume: string[]; ignoreTickerSteps?: boolean; stopTicker?: boolean; }): void; } interface AnchorExtensionProps { anchor?: PointData | number; } interface AnchorExtension { /** * The anchor sets the origin point of the imageContainer. The default value is taken from the {@link Texture} * and passed to the constructor. * * The default is `(0,0)`, this means the imageContainer's origin is the top left. * * Setting the anchor to `(0.5,0.5)` means the imageContainer's origin is centered. * * Setting the anchor to `(1,1)` would mean the imageContainer's origin point will be the bottom right corner. * * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. * @example * import { ImageContainer } from '@drincs/pixi-vn'; * * const imageContainer = new ImageContainer(); * imageContainer.anchor = 0.5; */ anchor: PointData; } interface ContainerOptions extends Omit, "on">, AnchorExtensionProps, AdditionalPositionsExtensionProps { } interface SpriteOptions extends Omit, AdditionalPositionsExtensionProps { } interface TextOptions extends Omit, AdditionalPositionsExtensionProps { } interface ImageContainerOptions extends ContainerOptions { } interface ImageSpriteOptions extends SpriteOptions { } interface VideoSpriteOptions extends ImageSpriteOptions { loop?: boolean; paused?: boolean; currentTime?: number; } /** * Interface for Asset memory */ interface AssetMemory { alias?: string; url: string; } interface SpriteBaseMemory extends SpriteOptions$1, CanvasBaseItemMemory, ListenerExtensionMemory, AdditionalPositionsExtensionProps { textureData?: AssetMemory; } /** * Interface for the canvas sprite memory */ interface SpriteMemory extends SpriteBaseMemory { } /** * This class is a extension of the [PIXI.Sprite class](https://pixijs.com/8.x/examples/sprite/basic), it has the same properties and methods, * but it has the ability to be saved and loaded by the Pixi’VN library. * @example * ```ts * const texture = await Assets.load('https://pixijs.com/assets/bunny.png'); * const sprite = Sprite.from(texture); * * sprite.anchor.set(0.5); * sprite.x = canvas.screen.width / 2; * sprite.y = canvas.screen.height / 2; * * sprite.eventMode = 'static'; * sprite.cursor = 'pointer'; * sprite.onEvent('pointerdown', EventTest); * * canvas.add("bunny", sprite); * ``` */ declare class Sprite extends _drincs_pixi_vn_pixi_js__default.Sprite implements CanvasBaseItem, ListenerExtension, AdditionalPositionsExtension { /** * @param options The options for the component. */ constructor(options?: SpriteOptions | Texture$1); readonly pixivnId: string; get memory(): Memory | SpriteMemory; setMemory(value: Memory | SpriteMemory): Promise; static from(source: Texture$1 | TextureSourceLike, skipCache?: boolean): Sprite; /** ListenerExtension */ readonly onEventsHandlers: OnEventsHandlers; on | keyof { [K: symbol]: any; [K: {} & string]: any; }>(event: T, fn: (...args: [ ...EventEmitter.ArgumentMap & { [K: symbol]: any; [K: {} & string]: any; }>[Extract | keyof { [K: symbol]: any; [K: {} & string]: any; }>], typeof this ]) => void, context?: any): this; /** AdditionalPositionsExtension */ private _align; set align(value: Partial | number); get align(): Partial | number; set xAlign(value: number); get xAlign(): number; set yAlign(value: number); get yAlign(): number; private _percentagePosition; set percentagePosition(value: Partial | number); get percentagePosition(): Partial | number; get percentageX(): number; set percentageX(_value: number); get percentageY(): number; set percentageY(_value: 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"; }); protected reloadPosition(): void; get position(): ObservablePoint; set position(value: ObservablePoint); get x(): number; set x(value: number); get y(): number; set y(value: number); } /** * The memory of the image. It uses for save the state of the image. */ interface ImageSpriteMemory extends SpriteBaseMemory { loadIsStarted: boolean; } /** * This class is a extension of the {@link Sprite} class, it has the same properties and methods, * but it has some features that make texture management easier. * You need to use {@link load} to show the image in the canvas. * This class is used for functions like {@link addImage} and {@link showWithDissolve}. * @example * ```ts * let alien = new ImageSprite({ * anchor: { x: 0.5, y: 0.5 }, * x: 100, * y: 100, * }, 'https://pixijs.com/assets/eggHead.png') * await alien.load() * canvas.add("alien", alien) * ``` * @example * ```ts * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png') * alien.anchor.set(0.5); * alien.x = 100 * alien.y = 100 * await alien.load() * ``` */ declare class ImageSprite extends Sprite { private _textureAlias?; protected get textureAlias(): string; readonly pixivnId: string; /** * @param options The options for the component. * @param textureAlias The URL or path. If you have initialized the "asset matrix", you can use the alias of the texture. */ constructor(options?: ImageSpriteOptions | Omit | undefined, textureAlias?: string); get memory(): ImageSpriteMemory; setMemory(memory: Memory | SpriteMemory): Promise; static from(source: Texture$1 | TextureSourceLike, skipCache?: boolean): ImageSprite; private _loadIsStarted; get loadIsStarted(): boolean; /** * Load the image from the link and set the texture of the sprite. * @returns A promise that resolves when the image is loaded. */ load(): Promise; set texture(value: Texture$1>); get texture(): Texture$1>; /** * Check if the texture is empty. * @returns A boolean that is true if the texture is empty. */ get haveEmptyTexture(): boolean; } /** * The memory of the video. It uses for save the state of the video. */ interface VideoSpriteMemory extends ImageSpriteMemory { loop: boolean; paused: boolean; currentTime: number; } /** * This class is a extension of the {@link ImageSprite} class, it has the same properties and methods, * but it has some features that make video management easier. * You need to use {@link load} to show the video in the canvas. * This class is used for functions like {@link addVideo} and {@link showWithDissolve}. * @example * ```ts * let film = new VideoSprite({ * x: 100, * y: 100, * }, 'https://pixijs.com/assets/video.mp4') * await film.load() * canvas.add("film", film) * ``` * @example * ```ts * let film = addVideo("film", 'https://pixijs.com/assets/video.mp4') * film.currentTime = 2 * await film.load() * ``` */ declare class VideoSprite extends ImageSprite { /** * @param options The options for the component. * @param textureAlias The URL or path. If you have initialized the "asset matrix", you can use the alias of the texture. */ constructor(options?: VideoSpriteOptions | Texture$1 | undefined, textureAlias?: string); readonly pixivnId: string; get memory(): VideoSpriteMemory; setMemory(value: VideoSpriteMemory): Promise; static from(source: Texture$1 | TextureSourceLike, skipCache?: boolean): VideoSprite; load(): Promise; private _looop; /** * Set to true if you want the video to loop. */ get loop(): boolean; set loop(value: boolean); private _paused; /** * Set to true if you want the video to be paused. */ get paused(): boolean; set paused(value: boolean); /** * Pause the video. */ pause(): void; /** * Play the video. */ play(): void; private _currentTime; /** * The current time of the video. */ get currentTime(): number; set currentTime(value: number); /** * Restart the video. */ restart(): void; /** * The duration of the video. */ get duration(): number | undefined; } /** * This class is a extension of the [PIXI.Container class](https://pixijs.com/8.x/examples/basic/container), it has the same properties and methods, * but it has the ability to be saved and loaded by the Pixi’VN library. * @example * ```ts * const container = new Container(); * canvas.add(container); * const texture = await Assets.load('https://pixijs.com/assets/bunny.png'); * for (let i = 0; i < 25; i++) * { * const bunny = new Sprite(texture); * bunny.x = (i % 5) * 40; * bunny.y = Math.floor(i / 5) * 40; * container.addChild(bunny); * } * ``` */ declare class Container extends Container$1 implements CanvasBaseItem, ListenerExtension, AnchorExtension, AdditionalPositionsExtension { constructor(options?: ContainerOptions); readonly pixivnId: string; get memory(): Memory; setMemory(value: Memory): Promise; protected importChildren(value: Memory): Promise; /** ListenerExtension */ readonly onEventsHandlers: OnEventsHandlers; on | keyof { [K: symbol]: any; [K: {} & string]: any; }>(event: T, fn: (...args: [ ...EventEmitter.ArgumentMap & { [K: symbol]: any; [K: {} & string]: any; }>[Extract | keyof { [K: symbol]: any; [K: {} & string]: any; }>], typeof this ]) => void, context?: any): this; /** Anchor */ private _anchor?; get anchor(): PointData; set anchor(value: PointData | number); protected reloadAnchor(): void; get pivot(): ObservablePoint; set pivot(value: ObservablePoint); /** AdditionalPositions */ private _align; set align(value: Partial | number); get align(): Partial | number; set xAlign(value: number); get xAlign(): number; set yAlign(value: number); get yAlign(): number; private _percentagePosition; set percentagePosition(value: Partial | number); get percentagePosition(): Partial | number; set percentageX(_value: number); get percentageX(): number; set percentageY(_value: number); get percentageY(): 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"; }); protected reloadPosition(): void; get position(): ObservablePoint; set position(value: ObservablePoint); get x(): number; set x(value: number); get y(): number; set y(value: number); } /** * Interface for the canvas container memory */ interface ImageContainerMemory extends ContainerMemory { elements: ImageSpriteMemory[]; anchor?: PointData; loadIsStarted: boolean; } /** * 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 load} functionality * @example * ```ts * 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 { /** * @param options The options for the component. * @param textureAliases An array of image URLs or paths. If you have initialized the "asset matrix", you can use the alias of the texture. */ constructor(options?: ImageContainerOptions, textureAliases?: string[]); get memory(): ImageContainerMemory; setMemory(value: ImageContainerMemory): Promise; readonly pixivnId: string; private _loadIsStarted; get loadIsStarted(): boolean; /** * Load the children images. * @returns A promise that resolves when the images are loaded. */ load(): Promise; /** * The texture of the first child. * If there is no child, it returns a new {@link Texture}. */ get texture(): Texture$1<_drincs_pixi_vn_pixi_js.TextureSource>; /** * 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; } /** * This class is responsible for managing the canvas, the tickers, the events, and the window size and the children of the window. */ declare class CanvasManagerStatic { private constructor(); private static _app; /** * The Pixi.js application instance. * @throws {PixiError} when the canvas has not been initialized yet (i.e. before calling `Game.init()`). */ static get app(): Application<_drincs_pixi_vn_pixi_js.Renderer>; static get gameLayer(): _drincs_pixi_vn_pixi_js.Container<_drincs_pixi_vn_pixi_js.ContainerChild>; /** * This is the div that have same size of the canvas. * This is useful to put interface elements. * You can use React or other framework to put elements in this div. */ static htmlLayers: HTMLElement[]; static canvasWidth: number; static canvasHeight: number; static _isInitialized: boolean; static init(element: HTMLElement, options?: Partial & { /** * The id of the canvas element. * @default "pixi-vn-canvas" */ id?: string; /** * The resize mode of the canvas. * @default "contain" */ resizeMode?: "contain" | "none"; }, devtoolsOptions?: Devtools): Promise; /** * Add the canvas into a html element. * @param element it is the html element where I will put the canvas. Example: document.body * @param id it is the id of the canvas element. */ private static addCanvasIntoHTMLElement; static addHtmlLayer(id: string, element: HTMLElement, style?: Partial>): HTMLDivElement; static removeHtmlLayer(id: string): void; static getHtmlLayer(id: string): HTMLElement | undefined; /** * This method is called when the screen is resized. */ private static resize; /** * The order of the elements in the canvas, is determined by the zIndex. */ static get childrenAliasesOrder(): string[]; /** Edit Tickers Methods */ static get currentTickersWithoutCreatedBySteps(): { [k: string]: TickerHistory; }; static readonly _currentTickers: Map>; static readonly _currentTickersSequence: Map>; static get currentTickersSequence(): { [alias: string]: { [tickerId: string]: TickersSequence; }; }; static readonly _currentTickersTimeouts: Map; static readonly _tickersToCompleteOnStepEnd: { tikersIds: { id: string; }[]; stepAlias: { id: string; alias: string; }[]; }; static generateTickerId(...args: any[]): string; static addTickerTimeoutInfo(aliases: string | string[], ticker: string, timeout: string, canBeDeletedBeforeEnd: boolean): void; static removeTickerTimeoutInfo(timeout: NodeJS.Timeout | string): void; static removeTickerTimeout(timeout: NodeJS.Timeout | string): void; static removeTickerTimeoutsByAlias(alias: string, checkCanBeDeletedBeforeEnd: boolean): void; } /** * Interface for the canvas text memory */ interface TextMemory extends TextOptions$1, CanvasBaseItemMemory, AdditionalPositionsExtensionProps, ListenerExtensionMemory { } /** * This class is a extension of the [PIXI.Text class](https://pixijs.com/8.x/examples/text/pixi-text), it has the same properties and methods, * but it has the ability to be saved and loaded by the Pixi’VN library. * @example * ```ts * const text = new Text(); * text.text = "Hello World" * canvas.add("text", text); * ``` */ declare class Text extends _drincs_pixi_vn_pixi_js__default.Text implements CanvasBaseItem, AdditionalPositionsExtension, ListenerExtension { constructor(options?: TextOptions); readonly pixivnId: string; get memory(): TextMemory; setMemory(value: TextMemory): Promise; readonly onEventsHandlers: OnEventsHandlers; on | keyof { [K: symbol]: any; [K: {} & string]: any; }>(event: T, fn: (...args: [ ...EventEmitter.ArgumentMap & { [K: symbol]: any; [K: {} & string]: any; }>[Extract | keyof { [K: symbol]: any; [K: {} & string]: any; }>], typeof this ]) => void, context?: any): this; /** AdditionalPositions */ private _align; set align(value: Partial | number); get align(): Partial | number; set xAlign(value: number); get xAlign(): number; set yAlign(value: number); get yAlign(): number; private _percentagePosition; set percentagePosition(value: Partial | number); get percentagePosition(): Partial | number; get percentageX(): number; set percentageX(_value: number); get percentageY(): number; set percentageY(_value: 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"; }); protected reloadPosition(): void; get position(): ObservablePoint; set position(value: ObservablePoint); get x(): number; set x(value: number); get y(): number; set y(value: number); } type CanvasElementAliasType = string; /** * Is a decorator that register a canvas component in the game. * @param options Options for the canvas component. * @returns * @example * ```ts title="canvas/components/AlienTinting.ts" * const ALIEN_TINTING_TEST_ID = "AlienTintingTest"; * @canvasComponentDecorator({ * name: ALIEN_TINTING_TEST_ID, * }) * class AlienTintingTest extends Sprite { * readonly pixivnId: string = CANVAS_SPINE_ID; * override get memory() { * // ... * } * override async setMemory(memory: IAlienTintingMemory) { * // ... * } * // ... * } * ``` */ declare function canvasComponentDecorator>(options?: { /** * The id used by Pixi’VN to refer to this class (must be unique). If you don't pass the id, the class name will be used as the id. * @default target.name */ name?: CanvasElementAliasType; /** * Function to get the instance of the canvas component. If not set, it will use the default constructor of the class. * This function is used into {@link canvas.restore} to restore the canvas. * @param canvasClass The class of the canvas component. * @param memory Memory of the canvas component. * @returns The instance of the canvas component. */ getInstance?: (canvasClass: T, memory: M) => CanvasBaseItem | Promise>; /** * Function to copy the properties of the canvas component. This function is used when to copy the properties of the canvas component into another instance of the same canvas component. * This function is used into {@link canvas.copyCanvasElementProperty} to copy the properties of the canvas component. * @param component The instance of the canvas component to copy the properties. * @param memory The memory of the canvas component to copy the properties. * @returns */ copyProperty?: (component: CanvasBaseItem, memory: M) => void | Promise; }): (target: T) => void; declare function setMemoryContainer(element: T | Container$1, memory: ContainerOptions$1 | {}, options?: { ignoreScale?: boolean; end?: () => Promise | void; }): Promise; declare namespace RegisteredCanvasComponents { /** * Register a canvas component in the game. * @param target The class of the canvas component. * @param options Options for the canvas component. */ function add>(target: T, options?: { /** * Name of the canvas component. If the name is already registered, it will show a warning * @default target.name */ name?: CanvasElementAliasType; /** * Function to get the instance of the canvas component. If not set, it will use the default constructor of the class. * This function is used into {@link canvas.restore} to restore the canvas. * @param canvasClass The class of the canvas component. * @param memory Memory of the canvas component. * @returns The instance of the canvas component. */ getInstance?: (canvasClass: T, memory: M) => CanvasBaseItem | Promise>; /** * Function to copy the properties of the canvas component. This function is used when to copy the properties of the canvas component into another instance of the same canvas component. * This function is used into {@link canvas.copyCanvasElementProperty} to copy the properties of the canvas component. * @param component The instance of the canvas component to copy the properties. * @param memory The memory of the canvas component to copy the properties. * @returns */ copyProperty?: (component: CanvasBaseItem, memory: M) => void | Promise; }): void; /** * Get a canvas component by the id. * @param canvasId The id of the canvas component. * @returns The canvas component type. */ function get>(canvasId: CanvasElementAliasType): T | undefined; function getInstance>(canvasId: CanvasElementAliasType, memory: M): Promise; function copyProperty(canvasId: CanvasElementAliasType, component: CanvasBaseItem, source: CanvasBaseItemMemory): Promise; /** * Get a list of all canvas components registered. * @returns An array of canvas components. */ function values(): (typeof CanvasBaseItem)[]; /** * Check if a canvas component is registered. * @param id The id of the canvas component. * @returns True if the canvas component is registered, false otherwise. */ function has(id: string): boolean; /** * Get a list of all canvas component ids registered. * @returns An array of label ids. */ function keys(): string[]; } type SerializableEventHandler = (...args: never[]) => unknown; /** * Is a decorator that register a event in the game. * Is a required decorator for use the event in the game. * Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game. * @example * ```ts * export class Events { * \@eventDecorator() * static eventExample(event: FederatedEvent, component: Sprite) { * // event code here * } * } * * sprite.on("pointerdown", Events.eventExample); * ``` * @param name The id used by Pixi’VN to refer to this function (must be unique). If you don't pass the id, the function name will be used as the id. * @returns */ declare function eventDecorator(name?: string): (_target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor) => void; declare namespace RegisteredEvents { /** * Register a event in the game. * @param fn The class of the event. * @param name Name of the event, by default it will use the class name. If the name is already registered, it will show a warning */ function add(fn: SerializableEventHandler, name: string): void; /** * Get a event by the id. * @param canvasId The id of the event. * @returns The event type. */ function get(name: string): SerializableEventHandler | undefined; /** * Get a list of all events registered. * @returns An array of events. */ function values(): SerializableEventHandler[]; /** * Check if a event is registered. * @param id The id of the event. * @returns True if the event is registered, false otherwise */ function has(id: string): boolean; /** * Get a list of all event ids registered. * @returns An array of label ids. */ function keys(): string[]; } /** * Shake the canvas element. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The alias to identify the component. * @param options Animation options, matching the `options` of animate function. * @param priority The priority of the PixiJS ticker. This parameter sets the ticker's priority. * @returns */ declare function shakeEffect(alias: string, options?: ShakeEffectProps, priority?: UPDATE_PRIORITY$1): Promise; declare namespace CanvasPropertyUtility { function calculatePositionByAlign(type: "width" | "height", align: number, value: number, pivot: number, negativeScale: boolean, anchor?: number): number; function calculateAlignByPosition(type: "width" | "height", position: number, value: number, pivot: number, negativeScale: boolean, anchor?: number): number; function calculatePositionByPercentagePosition(type: "width" | "height", percentage: number): number; function calculatePercentagePositionByPosition(type: "width" | "height", position: number): number; function getSuperPoint(point: { x: number; y: number; }, angle: number): { x: number; y: number; }; function getPointBySuperPoint(superPoint: { x: number; y: number; }, angle: number): { x: number; y: number; }; function getSuperWidth(canvasElement: Container$1): number; function getSuperHeight(canvasElement: Container$1): number; } interface BaseTransitionProps { /** * If true, the transition will be completed before the next step. * For example, if the transition is a dissolve transition, the "alpha" of the texture will be 1 before the next step. * @default true */ completeOnContinue?: boolean; } interface ShowWithDissolveTransitionProps extends BaseTransitionProps, AnimationOptions { } interface ShowWithFadeTransitionProps extends BaseTransitionProps, AnimationOptions { } interface MoveInOutProps extends BaseTransitionProps, AnimationOptions { /** * The direction of the movement. * @default "right" */ direction?: "up" | "down" | "left" | "right"; } interface ZoomInOutProps extends BaseTransitionProps, AnimationOptions { /** * The direction of the zoom effect. * @default "right" */ direction?: "up" | "down" | "left" | "right"; } interface PushInOutProps extends BaseTransitionProps, AnimationOptions { /** * The direction of the push effect. * @default "right" */ direction?: "up" | "down" | "left" | "right"; } type TComponent = CanvasBaseInterface | string | string[] | { value: string; options: ImageSpriteOptions; } | { value: string[]; options: ImageContainerOptions; }; /** * Show a image in the canvas with a disolve effect. * Disolve effect is a effect that the image is shown with a fade in. * If exist a image with the same alias, then the image is replaced and the first image is removed after the effect is done. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas. * If imageUrl is an array, then the {@link ImageContainer} is added to the canvas. * If you don't provide the component, then the alias is used as the url. * @param props The properties of the effect * @param priority The priority of the effect * @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded. */ declare function showWithDissolve(alias: string, component?: TComponent, props?: ShowWithDissolveTransitionProps, priority?: UPDATE_PRIORITY$1): Promise; /** * Remove a image from the canvas with a disolve effect. * Disolve effect is a effect that the image is removed with a fade out. * This function is equivalent to {@link removeWithFade}. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param props The properties of the effect * @param priority The priority of the effect * @returns The ids of the tickers that are used in the effect. */ declare function removeWithDissolve(alias: string, props?: ShowWithDissolveTransitionProps, priority?: UPDATE_PRIORITY$1): string[] | undefined; /** * Show a image in the canvas with a fade effect. * Fade effect is a effect that the image is shown with a fade in. * If exist a image with the same alias, the existing image is removed with a fade transition, and after the effect is done, the new image is shown with a fade transition. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas. * If imageUrl is an array, then the {@link ImageContainer} is added to the canvas. * If you don't provide the component, then the alias is used as the url. * @param props The properties of the effect * @param priority The priority of the effect * @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded. */ declare function showWithFade(alias: string, component?: TComponent, props?: ShowWithFadeTransitionProps, priority?: UPDATE_PRIORITY$1): Promise; /** * Remove a image from the canvas with a fade effect. * Fade effect is a effect that the image is removed with a fade out. * This function is equivalent to {@link removeWithDissolve}. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param props The properties of the effect * @param priority The priority of the effect * @returns The ids of the tickers that are used in the effect. */ declare function removeWithFade(alias: string, props?: ShowWithFadeTransitionProps, priority?: UPDATE_PRIORITY$1): string[] | undefined; /** * Show a image in the canvas with a move effect. The image is moved from outside the canvas to the x and y position of the image. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas. * If imageUrl is an array, then the {@link ImageContainer} is added to the canvas. * If you don't provide the component, then the alias is used as the url. * @param props The properties of the effect * @param priority The priority of the effect * @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded. */ declare function moveIn(alias: string, component?: TComponent, props?: MoveInOutProps & { /** * If true, then the old component is removed with a move out, after the new image is moved in. * @default false */ removeOldComponentWithMoveOut?: boolean; }, priority?: UPDATE_PRIORITY$1): Promise; /** * Remove a image from the canvas with a move effect. The image is moved from the x and y position of the image to outside the canvas. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param props The properties of the effect * @param priority The priority of the effect * @returns The ids of the tickers that are used in the effect. */ declare function moveOut(alias: string, props?: MoveInOutProps, priority?: UPDATE_PRIORITY$1): string[] | undefined; /** * Show a image in the canvas with a zoom effect. The image is zoomed in from the center of the canvas. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas. * If imageUrl is an array, then the {@link ImageContainer} is added to the canvas. * If you don't provide the component, then the alias is used as the url. * @param props The properties of the effect * @param priority The priority of the effect * @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded. */ declare function zoomIn(alias: string, component?: TComponent, props?: ZoomInOutProps & { /** * If true, then the old component is removed with a zoom out, after the new image is zoomed in. * @default false */ removeOldComponentWithZoomOut?: boolean; }, priority?: UPDATE_PRIORITY$1): Promise; /** * Remove a image from the canvas with a zoom effect. The image is zoomed out to the center of the canvas. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param props The properties of the effect * @param priority The priority of the effect * @returns The ids of the tickers that are used in the effect. */ declare function zoomOut(alias: string, props?: ZoomInOutProps, priority?: UPDATE_PRIORITY$1): string[] | undefined; /** * Show a image in the canvas with a push effect. The new image is pushed in from the inside of the canvas and the old image is pushed out to the outside of the canvas. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas. * If imageUrl is an array, then the {@link ImageContainer} is added to the canvas. * If you don't provide the component, then the alias is used as the url. * @param props The properties of the effect * @param priority The priority of the effect * @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded. */ declare function pushIn(alias: string, component?: TComponent, props?: PushInOutProps, priority?: UPDATE_PRIORITY$1): Promise; /** * Remove a image from the canvas with a push effect. The image is pushed out to the outside of the canvas. * If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param props The properties of the effect * @param priority The priority of the effect * @returns The ids of the tickers that are used in the effect. */ declare function pushOut(alias: string, props?: PushInOutProps, priority?: UPDATE_PRIORITY$1): string[] | undefined; /** * Canvas error handler: when a `PixiError` contains `canvasElementInfo`, * draw a simple `ErrorGraphics` placeholder on the canvas so the scene * remains visible and debuggable. */ declare function drawCanvasErrorHandler(): OnErrorHandler; /** * Add a list of images in the container, after that, the images are added to the canvas. * Is the same that {@link showImageContainer}, but the image is not shown. * If you want to show the container, then you need to use the function {@link ImageSprite.load()}. * @param alias is the unique alias of the container. You can use this alias to refer to this container * @param imageUrls is the url of the image. If you don't provide the url, then the alias is used as the url. * @param options The options of the container. * @returns This function returns an {@link ImageContainer} that you can use to manipulate the component. * @example * ```ts * let bunny = addImageContainer("bunny", ["https://pixijs.com/assets/bunny-body.png", "https://pixijs.com/assets/bunny-eyes.png"]) * await bunny.load() * ``` */ declare function addImageCointainer(alias: string, imageUrls: string[], options?: ImageContainerOptions): ImageContainer; /** * Add a list of images in the container, after that, the images are added and shown in the canvas. * @param alias The unique alias of the container. You can use this alias to refer to this container * @param imageUrls The url of the image. * @param options The options of the container. * @returns This function returns an {@link ImageContainer} that you can use to manipulate the component. * @example * ```ts * let bunny = showImageContainer("bunny", ["https://pixijs.com/assets/bunny-body.png", "https://pixijs.com/assets/bunny-eyes.png"]) * ``` */ declare function showImageContainer(alias: string, imageUrls: string[], options?: ImageContainerOptions): Promise; /** * Add a image in the canvas. * Is the same that {@link showImage}, but the image is not shown. * If you want to show the image, then you need to use the function {@link ImageSprite.load}. * @param alias is the unique alias of the image. You can use this alias to refer to this image * @param imageUrl The url of the image. If you have initialized the "asset matrix", you can use the alias of the texture. If you don't provide the URL, then the alias is used as the URL. * @param options The options of the image. * @returns This function returns an {@link ImageSprite} that you can use to manipulate the component. * @throws {PixiError} when `imageUrl` is not provided and `alias` is not registered in the asset cache. * @example * ```ts * let bunny1 = addImage("bunny1", "https://pixijs.com/assets/bunny1.png") * await bunny1.load() * Assets.add({ alias: "bunny2", src: "https://pixijs.com/assets/bunny2.png" }) * let bunny2 = addImage("bunny2") * await bunny2.load() * ``` */ declare function addImage(alias: string, imageUrl?: string, options?: ImageSpriteOptions): ImageSprite; /** * Add and show a image in the canvas. This function is a combination of {@link addImage}. * @param alias The unique alias of the image. You can use this alias to refer to this image * @param imageUrl The url of the image. If you have initialized the "asset matrix", you can use the alias of the texture. If you don't provide the URL, then the alias is used as the URL. * @param options The options of the image. * @returns This function returns an {@link ImageSprite} that you can use to manipulate the component. * @throws {PixiError} when `imageUrl` is not provided and `alias` is not registered in the asset cache. * @example * ```ts * let bunny1 = showImage("bunny1", "https://pixijs.com/assets/bunny1.png") * Assets.add({ alias: "bunny2", src: "https://pixijs.com/assets/bunny2.png" }) * let bunny2 = showImage("bunny2") * ``` */ declare function showImage(alias: string, imageUrl?: string, options?: ImageSpriteOptions): Promise; /** * Add and show a text in the canvas. * @param alias The unique alias of the text. You can use this alias to refer to this text. * @param text * @param options The options of the text. * @returns This function returns an {@link Text} that you can use to manipulate the component. * @example * ```ts * let text = showText("text", "Hello World", { fontSize: 24, fill: "white" }) * ``` */ declare function showText(alias: string, text: string, options?: Omit): Text; /** * Get a texture from a url. * @param textureAlias is the url of the file. * @returns the texture of the image or video, or `undefined` when `textureAlias` is the `"EMPTY"` sentinel value. * @throws {PixiError} when the alias is missing, the asset is not found in the cache/network, or the loaded resource is not a `Texture`. */ declare function getTexture(textureAlias?: string): Promise; /** * Add a video in the canvas. * Is the same that {@link showVideo}, but the video is not shown. * If you want to show the video, then you need to use the function {@link VideoSprite.load()}. * @param alias is the unique alias of the video. You can use this alias to refer to this video * @param videoUrl is the url of the video. If you don't provide the url, then the alias is used as the url. * @param options The options of the video. * @returns This function returns an {@link VideoSprite} that you can use to manipulate the component. * @throws {PixiError} when `videoUrl` is not provided and `alias` is not registered in the asset cache. * @example * ```ts * let video1 = addVideo("video1", "https://pixijs.com/assets/video1.mp4") * await video1.load() * Assets.add({ alias: "video2", src: "https://pixijs.com/assets/video2.png" }) * let video2 = addVideo("video2") * await video2.load() * ``` */ declare function addVideo(alias: string, videoUrl?: string, options?: VideoSpriteOptions): VideoSprite; /** * Add and show a video in the canvas. This function is a combination of {@link addVideo}. * @param alias The unique alias of the video. You can use this alias to refer to this video * @param videoUrl The url of the video. * @param options The options of the video. * @returns This function returns an {@link VideoSprite} that you can use to manipulate the component. * @throws {PixiError} when `videoUrl` is not provided and `alias` is not registered in the asset cache. * @example * ```ts * let video1 = showVideo("video1", "https://pixijs.com/assets/video1.mp4") * Assets.add({ alias: "video2", src: "https://pixijs.com/assets/video2.png" }) * let video2 = showVideo("video2") * ``` */ declare function showVideo(alias: string, videoUrl?: string, options?: VideoSpriteOptions): Promise; interface ShakeEffectProps extends BaseTransitionProps, AnimationOptions { /** * The number of shocks. **Must be at least 3**. * @default 10 */ shocksNumber?: number; /** * The type of the shake effect * @default "horizontal" */ shakeType?: "horizontal" | "vertical"; /** * The maximum size of the shock. * For horizontal type, it is the maximum size of the x axis. * For vertical type, it is the maximum size of the y axis. * @default 10 */ maxShockSize?: number; } /** * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/canvas'` * to constrain the set of valid asset aliases to a known union of string literals. * * When this interface has no keys (the default), {@link AssetAliasIdType} resolves to `string`, * preserving full backwards compatibility. Once you augment it, {@link AssetAliasIdType} becomes * the union of the declared keys and the compiler will reject any unknown asset alias. * * The augmentation is typically written into an auto-generated declaration file by the * Vite plugin (see the `assetsManifest` option of `vitePluginPixivn`), but it can * also be written by hand. * * @example * ```ts * // pixi-vn.gen.d.ts (auto-generated — do not edit manually) * declare module "@drincs/pixi-vn/canvas" { * interface PixivnAssetAliasIds { * logo: never; * hero: never; * } * } * export {}; * ``` */ interface PixivnAssetAliasIds { } /** * The type used wherever an asset alias is expected (e.g. `Assets.load`, `getTexture`). * * - **Default** — resolves to `string` so that existing code that passes arbitrary strings * continues to compile without any changes. * - **Augmented** — when {@link PixivnAssetAliasIds} has been extended via * `declare module "@drincs/pixi-vn/canvas"`, this type resolves to the union of the * declared keys, giving you compile-time safety against typos and unknown asset aliases. */ type AssetAliasIdType = [keyof PixivnAssetAliasIds] extends [never] ? string : keyof PixivnAssetAliasIds; /** * An empty interface that can be augmented via `declare module '@drincs/pixi-vn/canvas'` * to constrain the set of valid asset bundle names to a known union of string literals. * * When this interface has no keys (the default), {@link BundleIdType} resolves to `string`, * preserving full backwards compatibility. Once you augment it, {@link BundleIdType} becomes * the union of the declared keys and the compiler will reject any unknown bundle name. * * The augmentation is typically written into an auto-generated declaration file by the * Vite plugin (see the `assetsManifest` option of `vitePluginPixivn`), but it can * also be written by hand. * * @example * ```ts * // pixi-vn.gen.d.ts (auto-generated — do not edit manually) * declare module "@drincs/pixi-vn/canvas" { * interface PixivnBundleIds { * main: never; * ui: never; * } * } * export {}; * ``` */ interface PixivnBundleIds { } /** * The type used wherever an asset bundle name is expected (e.g. `Assets.loadBundle`). * * - **Default** — resolves to `string` so that existing code that passes arbitrary strings * continues to compile without any changes. * - **Augmented** — when {@link PixivnBundleIds} has been extended via * `declare module "@drincs/pixi-vn/canvas"`, this type resolves to the union of the * declared keys, giving you compile-time safety against typos and unknown bundle names. */ type BundleIdType = [keyof PixivnBundleIds] extends [never] ? string : keyof PixivnBundleIds; declare const Assets: _drincs_pixi_vn_pixi_js.AssetsClass; declare const Color: typeof _drincs_pixi_vn_pixi_js.Color; declare const Rectangle: typeof _drincs_pixi_vn_pixi_js.Rectangle; declare const TextStyle: typeof _drincs_pixi_vn_pixi_js.TextStyle; declare const Texture: typeof _drincs_pixi_vn_pixi_js.Texture; declare const UPDATE_PRIORITY: typeof _drincs_pixi_vn_pixi_js.UPDATE_PRIORITY; declare const canvas: CanvasManagerInterface; export { AdditionalPositionsExtension, AdditionalPositionsExtensionProps, type AnchorExtension, type AnchorExtensionProps, type AssetAliasIdType, type AssetMemory, Assets, type BundleIdType, type CanvasBaseInterface, CanvasBaseItem, CanvasBaseItemMemory, CanvasGameState, type CanvasHtmlLayersInterface, type CanvasLayersInterface, type CanvasManagerInterface, CanvasManagerStatic, CanvasPropertyUtility, type CanvasTickersInterface, Color, type CommonTickerProps, Container, ContainerChild$1 as ContainerChild, ContainerMemory, type ContainerOptions, ImageContainer, type ImageContainerMemory, type ImageContainerOptions, ImageSprite, type ImageSpriteMemory, type ImageSpriteOptions, type Layer, ListenerExtension, ListenerExtensionMemory, type MoveInOutProps, OnEventsHandlers, type PixivnAssetAliasIds, type PixivnBundleIds, type PushInOutProps, Rectangle, RegisteredCanvasComponents, RegisteredEvents, RegisteredTickers, type ShakeEffectProps, type ShowWithDissolveTransitionProps, type ShowWithFadeTransitionProps, Sprite, type SpriteBaseMemory, type SpriteMemory, type SpriteOptions, Text, type TextMemory, type TextOptions, TextStyle, Texture, Ticker$1 as Ticker, TickerArgs, TickerBase, TickerHistory, TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, TickersSequence, UPDATE_PRIORITY, VideoSprite, type VideoSpriteMemory, type VideoSpriteOptions, type ZoomInOutProps, addImage, addImageCointainer, addVideo, canvas, canvasComponentDecorator, drawCanvasErrorHandler, eventDecorator, getTexture, moveIn, moveOut, pushIn, pushOut, removeWithDissolve, removeWithFade, setMemoryContainer, shakeEffect, showImage, showImageContainer, showText, showVideo, showWithDissolve, showWithFade, tickerDecorator, zoomIn, zoomOut };