/**
* additional import for TypeScript
* @import {Vector2d} from "../math/vector2d.js";
*/
/**
* a generic Image Layer Object
* @category Game Objects
*/
export default class ImageLayer extends Sprite {
/**
* @param {number} x - x coordinate
* @param {number} y - y coordinate
* @param {object} settings - ImageLayer properties
* @param {HTMLImageElement|HTMLCanvasElement|CompressedImage|string} settings.image - Image reference. See {@link loader.getImage}
* @param {string} [settings.name="me.ImageLayer"] - layer name
* @param {number} [settings.z=0] - z-index position
* @param {number|Vector2d} [settings.ratio=1.0] - Scrolling ratio to be applied. See {@link ImageLayer#ratio}
* @param {"repeat"|"repeat-x"|"repeat-y"|"no-repeat"} [settings.repeat="repeat"] - define if and how an Image Layer should be repeated. See {@link ImageLayer#repeat}
* @param {number|Vector2d} [settings.anchorPoint=<0.0,0.0>] - Define how the image is anchored to the viewport bound. By default, its upper-left corner is anchored to the viewport bounds upper left corner.
* @example
* // create a repetitive background pattern on the X axis using the citycloud image asset
* app.world.addChild(new me.ImageLayer(0, 0, {
* image:"citycloud",
* repeat :"repeat-x"
* }), 1);
*/
constructor(x: number, y: number, settings: {
image: HTMLImageElement | HTMLCanvasElement | CompressedImage | string;
name?: string | undefined;
z?: number | undefined;
ratio?: number | Vector2d | undefined;
repeat?: "repeat" | "no-repeat" | "repeat-x" | "repeat-y" | undefined;
anchorPoint?: number | Vector2d | undefined;
});
/**
* Define the image scrolling ratio
* Scrolling speed is defined by multiplying the viewport delta position by the specified ratio.
* Setting this vector to <0.0,0.0> will disable automatic scrolling.
* To specify a value through Tiled, use one of the following format :
* - a number, to change the value for both axis
* - a json expression like `json:{"x":0.5,"y":0.5}` if you wish to specify a different value for both x and y
* @type {Vector2d}
* @default <1.0,1.0>
*/
ratio: Vector2d;
set repeat(value: string);
/**
* Define if and how an Image Layer should be repeated.
* By default, an Image Layer is repeated both vertically and horizontally.
* Acceptable values :
* - 'repeat' - The background image will be repeated both vertically and horizontally
* - 'repeat-x' - The background image will be repeated only horizontally.
* - 'repeat-y' - The background image will be repeated only vertically.
* - 'no-repeat' - The background-image will not be repeated.
* @type {string}
* @default 'repeat'
*/
get repeat(): string;
_repeat: string | undefined;
repeatX: boolean | undefined;
repeatY: boolean | undefined;
onActivateEvent(): void;
/**
* resize the Image Layer to match the given size
* @param {number} w - new width
* @param {number} h - new height
*/
resize(w: number, h: number): this;
/**
* createPattern function
* @ignore
*/
createPattern(): void;
_pattern: any;
/**
* updateLayer function
* @ignore
*/
updateLayer(): void;
/**
* override the default predraw function
* as repeat and anchor are managed directly in the draw method
* @ignore
*/
preDraw(renderer: any): void;
/**
* draw this ImageLayer (automatically called by melonJS)
* @protected
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
* @param {Camera2d} [viewport] - the viewport to (re)draw
*/
protected draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
onDeactivateEvent(): void;
}
import Sprite from "./sprite.js";
import type { Vector2d } from "../math/vector2d.js";
//# sourceMappingURL=imagelayer.d.ts.map