@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
53 lines (50 loc) • 2.06 kB
TypeScript
import { SpriteOptions, Texture, TextureSourceLike } from 'pixi.js';
import ICanvasImageMemory from '../../interface/canvas/ICanvasImageMemory.js';
import CanvasSprite from './CanvasSprite.js';
import '../../interface/canvas/ICanvasSpriteMemory.js';
import '../../types/EventIdType.js';
import '../../interface/canvas/ICanvasBaseMemory.js';
import '../../interface/canvas/ITextureMemory.js';
import '../../types/CanvasEventNamesType.js';
import '../CanvasEvent.js';
import './CanvasBase.js';
declare const CANVAS_IMAGE_ID = "CanvasImage";
/**
* This class is a extension of the CanvasSprite class, it has the same properties and methods,
* but it has some features that make texture management easier.
* You need to use CanvasImage.load() to show the image in the canvas.
* This class is used for functions like {@link addImage}, {@link loadImage} and {@link showWithDissolveTransition}.
* @example
* ```typescript
* let alien = new CanvasImage({
* anchor: { x: 0.5, y: 0.5 },
* x: 100,
* y: 100,
* }, 'https://pixijs.com/assets/eggHead.png')
* await alien.load()
* GameWindowManager.addCanvasElement("alien", alien)
* ```
* @example
* ```typescript
* 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 CanvasImage extends CanvasSprite<ICanvasImageMemory> {
pixivnId: string;
constructor(options?: SpriteOptions | Texture | undefined, imageLink?: string);
get memory(): ICanvasImageMemory;
set memory(memory: ICanvasImageMemory);
imageLink: string;
static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasImage;
/**
* Load the image from the link and set the texture of the sprite.
* @param image The link of the image. If it is not set, it will use the imageLink property.
* @returns A promise that resolves when the image is loaded.
*/
load(image?: string): Promise<void>;
}
export { CANVAS_IMAGE_ID, CanvasImage as default };