import * as PIXI from 'pixi.js'; import { Vector2, XY } from './Vector2'; export declare class ObservableVector2 implements PIXI.IPoint { cb: (this: T) => any; scope: T; private fromObject?; _x: number; _y: number; /** * Creates a new ObservableVector2. * @param cb - The callback to call whenever a value change. * @param scope - Owner of callback * @param x - Position of the vector on the X axis. * @param y - Position of the vector on the Y axis. * @param fromObject */ constructor(cb: (this: T) => any, scope: T, x?: number, y?: number, fromObject?: PIXI.ObservablePoint | undefined); /** * XY values. * @returns - An array containing the x-component and y-component of the vector. */ get xy(): XY; /** * Sets the XY values. * @param values - An array containing the new x-component and y-component of the vector */ set xy(values: XY); /** * The X value. * @returns - The x-component of the vector */ get x(): number; /** * Set the x-component. * @param value - The new x-component of the vector */ set x(value: number); /** * The Y value. * @returns - The y-component of the vector */ get y(): number; /** * Set the y-component. * @param value - The new y-component of the vector */ set y(value: number); /** * Create an ObservableVector2 from a PIXI.ObservablePoint. * @param point - The point. * @returns - The ObservableVector2. */ static fromPoint(point: PIXI.ObservablePoint): ObservableVector2; /** * Checks if two vectors are equal, using a threshold to avoid floating-point precision errors. * @param other - The other vector to compare with. * @param threshold - The minimal difference required to say that the vectors are different, to avoid floating-point precision errors. * @returns - If vectors are equals. */ equals(other: PIXI.IPointData, threshold?: number): boolean; /** * Copies the x and y components from the source to the destination. The source and destination must be of the same type. * @param src The source point. * @returns - Returns itself. */ copyFrom(src: PIXI.IPointData): this; /** * Copies the x- and y-components from the source to the destination. The source and destination must be of the same type. * @typeParam T The type of your source, can also be a ObservableVector2. * @param p The source point. * @returns - The resulting object. */ copyTo(p: T): T; /** * Return the absolute values of X and Y. * @param dest - An optional destination. * @returns - The absolute values of X and Y. */ abs(dest?: ObservableVector2): ObservableVector2; /** * Sets both the x- and y-components of the vector to 0. */ reset(): void; /** * Sets the point to a new x and y position. * If y is omitted, both x and y will be set to x. */ set(x: number, y: number): this; set(value?: number): this; /** * Returns true if both X & Y are greater than the other vector. * @param other - The vector to compare with. * @returns - Are both X & Y greater than the other vector. */ greaterThan(other: PIXI.IPointData): boolean; /** * Returns the distance from the vector to the origin. */ length(): number; /** * Returns the distance from the vector to the origin, squared. */ squaredLength(): number; /** * Adds two vectors together. * If no dest vector is specified, the operation is performed in-place. * @param vector - The vector to add. * @param dest - An optional destination. * @returns - The vector added. */ add(vector: PIXI.IPointData, dest?: ObservableVector2): ObservableVector2; /** * Subtracts one vector from another. * If no dest vector is specified, the operation is performed in-place. * @param vector - The vector to subtract with. * @param dest - An optional destination. * @returns - The vector subtracted. */ subtract(vector: PIXI.IPointData, dest?: ObservableVector2): ObservableVector2; /** * Multiplies two vectors together piecewise. * If no dest vector is specified, the operation is performed in-place. * @param vector - The vector to multiply with. * @param dest - An optional destination. * @returns - The vector multiplied. */ multiply(vector: PIXI.IPointData, dest?: ObservableVector2): ObservableVector2; /** * Divides two vectors piecewise. * @param vector - The vector to divide with. * @param dest - An optional destination. * @returns - The vector divided. */ divide(vector: PIXI.IPointData, dest?: ObservableVector2): ObservableVector2; /** * Scales a vector by a scalar parameter. * If no dest vector is specified, the operation is performed in-place. * @param value - The value to multiply the values to. * @param dest - An optional destination. * @returns - The vector scaled. */ scale(value: number, dest?: ObservableVector2): ObservableVector2; /** * Normalizes a vector. * If no dest vector is specified, the operation is performed in-place. * * @param dest - An optional destination. * @returns - The vector normalized. */ normalize(dest?: ObservableVector2): ObservableVector2; toString(): string; /** * Multiplies both the x- and y-components of a vector by -1. * If no dest vector is specified, the operation is performed in-place. * @param dest - An optional destination. * @returns - The vector negated. */ negate(dest?: ObservableVector2): ObservableVector2; clone(cb?: (this: T) => any, scope?: T): ObservableVector2; deepClone(): ObservableVector2; toJSON(): { x: number; y: number; }; /** * Convert this to a ObservableVector2. * @returns - The ObservableVector2. */ toVector(): Vector2; }