mirror of
https://github.com/photonstorm/phaser
synced 2024-12-11 13:56:16 +00:00
1900 lines
49 KiB
TypeScript
1900 lines
49 KiB
TypeScript
// Type definitions for PIXI 2.2.0 dev 2014-11-02
|
|
// Project: https://github.com/GoodBoyDigital/pixi.js/
|
|
|
|
declare module PIXI {
|
|
|
|
export var WEBGL_RENDERER: number;
|
|
export var CANVAS_RENDERER: number;
|
|
export var VERSION: string;
|
|
|
|
export enum blendModes {
|
|
|
|
NORMAL,
|
|
ADD,
|
|
MULTIPLY,
|
|
SCREEN,
|
|
OVERLAY,
|
|
DARKEN,
|
|
LIGHTEN,
|
|
COLOR_DODGE,
|
|
COLOR_BURN,
|
|
HARD_LIGHT,
|
|
SOFT_LIGHT,
|
|
DIFFERENCE,
|
|
EXCLUSION,
|
|
HUE,
|
|
SATURATION,
|
|
COLOR,
|
|
LUMINOSITY
|
|
|
|
}
|
|
|
|
export enum scaleModes {
|
|
|
|
DEFAULT,
|
|
LINEAR,
|
|
NEAREST
|
|
|
|
}
|
|
|
|
export var defaultRenderOptions: PixiRendererOptions;
|
|
|
|
export var INTERACTION_REQUENCY: number;
|
|
export var AUTO_PREVENT_DEFAULT: boolean;
|
|
|
|
export var PI_2: number;
|
|
export var RAD_TO_DEG: number;
|
|
export var DEG_TO_RAD: number;
|
|
|
|
export var RETINA_PREFIX: string;
|
|
export var identityMatrix: Matrix;
|
|
export var glContexts: WebGLRenderingContext[];
|
|
export var instances: any[];
|
|
|
|
export var BaseTextureCache: { [key: string]: BaseTexture }
|
|
export var TextureCache: { [key: string]: Texture }
|
|
|
|
export function isPowerOfTwo(width: number, height: number): boolean;
|
|
|
|
export function rgb2hex(rgb: number[]): string;
|
|
export function hex2rgb(hex: string): number[];
|
|
|
|
export function autoDetectRenderer(width?: number, height?: number, options?: PixiRendererOptions): PixiRenderer;
|
|
export function autoDetectRecommendedRenderer(width?: number, height?: number, options?: PixiRendererOptions): PixiRenderer;
|
|
|
|
export function canUseNewCanvasBlendModes(): boolean;
|
|
export function getNextPowerOfTwo(number: number): number;
|
|
|
|
export function AjaxRequest(): XMLHttpRequest;
|
|
|
|
export function CompileFragmentShader(gl: WebGLRenderingContext, shaderSrc: string[]): any;
|
|
export function CompileProgram(gl: WebGLRenderingContext, vertexSrc: string[], fragmentSrc: string[]): any;
|
|
|
|
|
|
export interface IEventCallback {
|
|
(e?: IEvent): void
|
|
}
|
|
|
|
export interface IEvent {
|
|
type: string;
|
|
content: any;
|
|
}
|
|
|
|
export interface HitArea {
|
|
contains(x: number, y: number): boolean;
|
|
}
|
|
|
|
export interface IInteractionDataCallback {
|
|
(interactionData: InteractionData): void
|
|
}
|
|
|
|
export interface PixiRenderer {
|
|
|
|
autoResize: boolean;
|
|
height: number;
|
|
transparent: boolean;
|
|
type: number;
|
|
width: number;
|
|
view: HTMLCanvasElement;
|
|
|
|
render(stage: Stage): void;
|
|
resize(width: number, height: number): void;
|
|
|
|
}
|
|
|
|
export interface PixiRendererOptions {
|
|
|
|
autoResize?: boolean;
|
|
antialias?: boolean;
|
|
clearBeforeRender?: boolean;
|
|
preserveDrawingBuffer?: boolean;
|
|
resolution?: number;
|
|
transparent?: boolean;
|
|
view?: HTMLCanvasElement;
|
|
|
|
}
|
|
|
|
export interface BitmapTextStyle {
|
|
|
|
font?: string;
|
|
align?: string;
|
|
tint?: string;
|
|
|
|
}
|
|
|
|
export interface TextStyle {
|
|
|
|
align?: string;
|
|
dropShadow?: boolean;
|
|
dropShadowColor?: string;
|
|
dropShadowAngle?: number;
|
|
dropShadowDistance?: number;
|
|
fill?: string;
|
|
font?: string;
|
|
stroke?: string;
|
|
strokeThickness?: number;
|
|
wordWrap?: boolean;
|
|
wordWrapWidth?: number;
|
|
|
|
}
|
|
|
|
export interface Loader {
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export interface MaskData {
|
|
|
|
alpha: number;
|
|
worldTransform: number[];
|
|
|
|
}
|
|
|
|
export interface RenderSession {
|
|
|
|
context: CanvasRenderingContext2D;
|
|
maskManager: CanvasMaskManager;
|
|
scaleMode: scaleModes;
|
|
smoothProperty: string;
|
|
roundPixels: boolean;
|
|
|
|
}
|
|
|
|
export interface ShaderAttribute {
|
|
// TODO: Find signature of shader attributes
|
|
}
|
|
|
|
export interface FilterBlock {
|
|
|
|
visible: boolean;
|
|
renderable: boolean;
|
|
|
|
}
|
|
|
|
export class AbstractFilter {
|
|
|
|
constructor(fragmentSrc: string[], uniforms: any);
|
|
|
|
dirty: boolean;
|
|
padding: number;
|
|
uniforms: any;
|
|
fragmentSrc: string[];
|
|
|
|
apply(frameBuffer: WebGLFramebuffer): void;
|
|
syncUniforms(): void;
|
|
|
|
}
|
|
|
|
export class AlphaMaskFilter extends AbstractFilter {
|
|
|
|
constructor(texture: Texture);
|
|
|
|
map: Texture;
|
|
|
|
onTextureLoaded(): void;
|
|
|
|
}
|
|
|
|
export class AsciiFilter extends AbstractFilter {
|
|
|
|
size: number;
|
|
|
|
}
|
|
|
|
export class AssetLoader implements Mixin {
|
|
|
|
assetURLs: string[];
|
|
crossorigin: boolean;
|
|
loadersByType: { [key: string]: Loader };
|
|
|
|
constructor(assetURLs: string[], crossorigin: boolean);
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
|
|
}
|
|
|
|
export class AtlasLoader implements Mixin {
|
|
|
|
url: string;
|
|
baseUrl: string;
|
|
crossorigin: boolean;
|
|
loaded: boolean;
|
|
|
|
constructor(url: string, crossorigin: boolean);
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export class BaseTexture implements Mixin {
|
|
|
|
static fromImage(imageUrl: string, crossorigin?: boolean, scaleMode?: scaleModes): BaseTexture;
|
|
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: scaleModes): BaseTexture;
|
|
|
|
constructor(source: HTMLImageElement, scaleMode: scaleModes);
|
|
constructor(source: HTMLCanvasElement, scaleMode: scaleModes);
|
|
|
|
height: number;
|
|
hasLoaded: boolean;
|
|
mipmap: boolean;
|
|
premultipliedAlpha: boolean;
|
|
resolution: number;
|
|
scaleMode: scaleModes;
|
|
source: HTMLImageElement;
|
|
width: number;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
destroy(): void;
|
|
dirty(): void;
|
|
updateSourceImage(newSrc: string): void;
|
|
unloadFromGPU(): void;
|
|
|
|
}
|
|
|
|
export class BitmapFontLoader implements Mixin {
|
|
|
|
constructor(url: string, crossorigin: boolean);
|
|
|
|
baseUrl: string;
|
|
crossorigin: boolean;
|
|
texture: Texture;
|
|
url: string;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export class BitmapText extends DisplayObjectContainer {
|
|
|
|
static fonts: any;
|
|
|
|
constructor(text: string, style: BitmapTextStyle);
|
|
|
|
dirty: boolean;
|
|
fontName: string;
|
|
fontSize: number;
|
|
textWidth: number;
|
|
textHeight: number;
|
|
tint: number;
|
|
style: BitmapTextStyle;
|
|
|
|
setText(text: string): void;
|
|
setStyle(style: BitmapTextStyle): void;
|
|
|
|
}
|
|
|
|
export class BlurFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
blurX: number;
|
|
blurY: number;
|
|
|
|
}
|
|
|
|
export class BlurXFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
|
|
}
|
|
|
|
export class BlurYFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
|
|
}
|
|
|
|
export class CanvasBuffer {
|
|
|
|
constructor(width: number, height: number);
|
|
|
|
canvas: HTMLCanvasElement;
|
|
context: CanvasRenderingContext2D;
|
|
height: number;
|
|
width: number;
|
|
|
|
clear(): void;
|
|
resize(width: number, height: number): void;
|
|
|
|
}
|
|
|
|
export class CanvasMaskManager {
|
|
|
|
pushMask(maskData: MaskData, renderSession: RenderSession): void;
|
|
popMask(renderSession: RenderSession): void;
|
|
|
|
}
|
|
|
|
export class CanvasRenderer implements PixiRenderer {
|
|
|
|
constructor(width?: number, height?: number, options?: PixiRendererOptions);
|
|
|
|
autoResize: boolean;
|
|
clearBeforeRender: boolean;
|
|
context: CanvasRenderingContext2D;
|
|
count: number;
|
|
height: number;
|
|
maskManager: CanvasMaskManager;
|
|
refresh: boolean;
|
|
renderSession: RenderSession;
|
|
resolution: number;
|
|
transparent: boolean;
|
|
type: number;
|
|
view: HTMLCanvasElement;
|
|
width: number;
|
|
|
|
destroy(removeView?: boolean): void;
|
|
render(stage: Stage): void;
|
|
resize(width: number, height: number): void;
|
|
|
|
}
|
|
|
|
export class CanvasTinter {
|
|
|
|
static getTintedTexture(sprite: Sprite, color: number): HTMLCanvasElement;
|
|
static tintWithMultiply(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
|
|
static tintWithOverlay(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
|
|
static tintWithPerPixel(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
|
|
static roundColor(color: number): void;
|
|
|
|
static cacheStepsPerColorChannel: number;
|
|
static convertTintToImage: boolean;
|
|
static canUseMultiply: boolean;
|
|
static tintMethod: any;
|
|
|
|
}
|
|
|
|
export class Circle implements HitArea {
|
|
|
|
constructor(x: number, y: number, radius: number);
|
|
|
|
x: number;
|
|
y: number;
|
|
radius: number;
|
|
|
|
clone(): Circle;
|
|
contains(x: number, y: number): boolean;
|
|
getBounds(): Rectangle;
|
|
|
|
}
|
|
|
|
export class ColorMatrixFilter extends AbstractFilter {
|
|
|
|
matrix: Matrix;
|
|
|
|
}
|
|
|
|
export class ColorStepFilter extends AbstractFilter {
|
|
|
|
step: number;
|
|
|
|
}
|
|
|
|
export class ConvolutionFilter extends AbstractFilter {
|
|
|
|
constructor(matrix: number[], width: number, height: number);
|
|
|
|
matrix: Matrix;
|
|
width: number;
|
|
height: number;
|
|
|
|
}
|
|
|
|
export class CrossHatchFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
|
|
}
|
|
|
|
export class DisplacementFilter extends AbstractFilter {
|
|
|
|
constructor(texture: Texture);
|
|
|
|
map: Texture;
|
|
offset: Point;
|
|
scale: Point;
|
|
|
|
}
|
|
|
|
export class DotScreenFilter extends AbstractFilter {
|
|
|
|
angle: number;
|
|
scale: Point;
|
|
|
|
}
|
|
|
|
export class DisplayObject {
|
|
|
|
alpha: number;
|
|
buttonMode: boolean;
|
|
cacheAsBitmap: boolean;
|
|
defaultCursor: string;
|
|
filterArea: Rectangle;
|
|
filters: AbstractFilter[];
|
|
hitArea: HitArea;
|
|
interactive: boolean;
|
|
mask: Graphics;
|
|
parent: DisplayObjectContainer;
|
|
pivot: Point;
|
|
position: Point;
|
|
renderable: boolean;
|
|
rotation: number;
|
|
scale: Point;
|
|
stage: Stage;
|
|
visible: boolean;
|
|
worldAlpha: number;
|
|
worldVisible: boolean;
|
|
x: number;
|
|
y: number;
|
|
|
|
click(e: InteractionData): void;
|
|
displayObjectUpdateTransform(): void;
|
|
getBounds(matrix?: Matrix): Rectangle;
|
|
getLocalBounds(): Rectangle;
|
|
generateTexture(resolution: number, scaleMode: scaleModes, renderer: PixiRenderer): RenderTexture;
|
|
mousedown(e: InteractionData): void;
|
|
mouseout(e: InteractionData): void;
|
|
mouseover(e: InteractionData): void;
|
|
mouseup(e: InteractionData): void;
|
|
mousemove(e: InteractionData): void;
|
|
mouseupoutside(e: InteractionData): void;
|
|
rightclick(e: InteractionData): void;
|
|
rightdown(e: InteractionData): void;
|
|
rightup(e: InteractionData): void;
|
|
rightupoutside(e: InteractionData): void;
|
|
setStageReference(stage: Stage): void;
|
|
tap(e: InteractionData): void;
|
|
toGlobal(position: Point): Point;
|
|
toLocal(position: Point, from: DisplayObject): Point;
|
|
touchend(e: InteractionData): void;
|
|
touchendoutside(e: InteractionData): void;
|
|
touchstart(e: InteractionData): void;
|
|
touchmove(e: InteractionData): void;
|
|
updateTransform(): void;
|
|
|
|
}
|
|
|
|
export class DisplayObjectContainer extends DisplayObject {
|
|
|
|
constructor();
|
|
|
|
children: DisplayObject[];
|
|
height: number;
|
|
width: number;
|
|
|
|
addChild(child: DisplayObject): DisplayObject;
|
|
addChildAt(child: DisplayObject, index: number): DisplayObject;
|
|
getBounds(): Rectangle;
|
|
getChildAt(index: number): DisplayObject;
|
|
getChildIndex(child: DisplayObject): number;
|
|
getLocalBounds(): Rectangle;
|
|
removeChild(child: DisplayObject): DisplayObject;
|
|
removeChildAt(index: number): DisplayObject;
|
|
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
|
|
removeStageReference(): void;
|
|
setChildIndex(child: DisplayObject, index: number): void;
|
|
swapChildren(child: DisplayObject, child2: DisplayObject): void;
|
|
|
|
}
|
|
|
|
export class Ellipse implements HitArea {
|
|
|
|
constructor(x: number, y: number, width: number, height: number);
|
|
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
|
|
clone(): Ellipse;
|
|
contains(x: number, y: number): boolean;
|
|
getBounds(): Rectangle;
|
|
|
|
}
|
|
|
|
export class Event {
|
|
|
|
constructor(target: any, name: string, data: any);
|
|
|
|
target: any;
|
|
type: string;
|
|
data: any;
|
|
timeStamp: number;
|
|
|
|
stopPropagation(): void;
|
|
preventDefault(): void;
|
|
stopImmediatePropagation(): void;
|
|
|
|
}
|
|
|
|
export class EventTarget {
|
|
|
|
static mixin(obj: any): void;
|
|
|
|
}
|
|
|
|
export class FilterTexture {
|
|
|
|
constructor(gl: WebGLRenderingContext, width: number, height: number, scaleMode: scaleModes);
|
|
|
|
fragmentSrc: string[];
|
|
frameBuffer: WebGLFramebuffer;
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
scaleMode: number;
|
|
texture: WebGLTexture;
|
|
|
|
clear(): void;
|
|
resize(width: number, height: number): void;
|
|
destroy(): void;
|
|
|
|
}
|
|
|
|
export class GraphicsData {
|
|
|
|
constructor(lineWidth?: number, lineColor?: number, lineAlpha?: number, fillColor?: number, fillAlpha?: number, fill?: boolean, shape?: any);
|
|
|
|
lineWidth: number;
|
|
lineColor: number;
|
|
lineAlpha: number;
|
|
fillColor: number;
|
|
fillAlpha: number;
|
|
fill: boolean;
|
|
shape: any;
|
|
type: number;
|
|
|
|
}
|
|
|
|
export class Graphics extends DisplayObjectContainer {
|
|
|
|
static POLY: number;
|
|
static RECT: number;
|
|
static CIRC: number;
|
|
static ELIP: number;
|
|
static RREC: number;
|
|
|
|
blendMode: number;
|
|
boundsPadding: number;
|
|
fillAlpha: number;
|
|
isMask: boolean;
|
|
lineWidth: number;
|
|
lineColor: string;
|
|
tint: number;
|
|
worldAlpha: number;
|
|
|
|
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics;
|
|
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
|
|
beginFill(color?: number, alpha?: number): Graphics;
|
|
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
|
|
clear(): Graphics;
|
|
destroyCachedSprite(): void;
|
|
drawCircle(x: number, y: number, radius: number): Graphics;
|
|
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
|
|
drawPolygon(path: any): Graphics;
|
|
drawRect(x: number, y: number, width: number, height: number): Graphics;
|
|
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
|
|
drawShape(shape: Circle): GraphicsData;
|
|
drawShape(shape: Rectangle): GraphicsData;
|
|
drawShape(shape: Ellipse): GraphicsData;
|
|
drawShape(shape: Polygon): GraphicsData;
|
|
endFill(): Graphics;
|
|
lineStyle(lineWidth?: number, color?: number, alpha?: number): Graphics;
|
|
lineTo(x: number, y: number): Graphics;
|
|
moveTo(x: number, y: number): Graphics;
|
|
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
|
|
|
|
}
|
|
|
|
export class GrayFilter extends AbstractFilter {
|
|
|
|
gray: number;
|
|
|
|
}
|
|
|
|
export class ImageLoader implements Mixin {
|
|
|
|
constructor(url: string, crossorigin?: boolean);
|
|
|
|
texture: Texture;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
loadFramedSpriteSheet(frameWidth: number, frameHeight: number, textureName: string): void;
|
|
|
|
}
|
|
|
|
export class InteractionData {
|
|
|
|
global: Point;
|
|
target: Sprite;
|
|
originalEvent: Event;
|
|
|
|
getLocalPosition(displayObject: DisplayObject): Point;
|
|
|
|
}
|
|
|
|
export class InteractionManager {
|
|
|
|
currentCursorStyle: string;
|
|
last: number;
|
|
mouse: InteractionData;
|
|
mouseOut: boolean;
|
|
mouseoverEnabled: boolean;
|
|
onMouseMove: Function;
|
|
onMouseDown: Function;
|
|
onMouseOut: Function;
|
|
onMouseUp: Function;
|
|
onTouchStart: Function;
|
|
onTouchEnd: Function;
|
|
onTouchMove: Function;
|
|
pool: InteractionData[];
|
|
resolution: number;
|
|
stage: Stage;
|
|
touches: { [id: string]: InteractionData };
|
|
|
|
constructor(stage: Stage);
|
|
}
|
|
|
|
export class InvertFilter extends AbstractFilter {
|
|
|
|
invert: number;
|
|
|
|
}
|
|
|
|
export class JsonLoader implements Mixin {
|
|
|
|
constructor(url: string, crossorigin?: boolean);
|
|
|
|
baseUrl: string;
|
|
crossorigin: boolean;
|
|
loaded: boolean;
|
|
url: string;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export class Matrix {
|
|
|
|
a: number;
|
|
b: number;
|
|
c: number;
|
|
d: number;
|
|
tx: number;
|
|
ty: number;
|
|
|
|
append(matrix: Matrix): Matrix;
|
|
apply(pos: Point, newPos: Point): Point;
|
|
applyInverse(pos: Point, newPos: Point): Point;
|
|
determineMatrixArrayType(): number[];
|
|
identity(): Matrix;
|
|
rotate(angle: number): Matrix;
|
|
fromArray(array: number[]): void;
|
|
translate(x: number, y: number): Matrix;
|
|
toArray(transpose: boolean): number[];
|
|
scale(x: number, y: number): Matrix;
|
|
|
|
}
|
|
|
|
export interface Mixin {
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
}
|
|
|
|
export class MovieClip extends Sprite {
|
|
|
|
static fromFrames(frames: string[]): MovieClip;
|
|
static fromImages(images: HTMLImageElement[]): HTMLImageElement;
|
|
|
|
constructor(textures: Texture[]);
|
|
|
|
animationSpeed: number;
|
|
currentFrame: number;
|
|
loop: boolean;
|
|
playing: boolean;
|
|
textures: Texture[];
|
|
totalFrames: number;
|
|
|
|
gotoAndPlay(frameNumber: number): void;
|
|
gotoAndStop(frameNumber: number): void;
|
|
onComplete(): void;
|
|
play(): void;
|
|
stop(): void;
|
|
|
|
}
|
|
|
|
export class NoiseFilter extends AbstractFilter {
|
|
|
|
noise: number;
|
|
|
|
}
|
|
|
|
export class NormalMapFilter extends AbstractFilter {
|
|
|
|
map: Texture;
|
|
offset: Point;
|
|
scale: Point;
|
|
|
|
}
|
|
|
|
export class PixelateFilter extends AbstractFilter {
|
|
|
|
size: number;
|
|
|
|
}
|
|
|
|
export interface IPixiShader {
|
|
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class PixiShader implements IPixiShader {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
attributes: ShaderAttribute[];
|
|
defaultVertexSrc: string[];
|
|
dirty: boolean;
|
|
firstRun: boolean;
|
|
textureCount: number;
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
initSampler2D(): void;
|
|
initUniforms(): void;
|
|
syncUniforms(): void;
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class PixiFastShader implements IPixiShader {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
textureCount: number;
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class PrimitiveShader implements IPixiShader {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class ComplexPrimitiveShader implements IPixiShader {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class StripShader implements IPixiShader {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
fragmentSrc: string[];
|
|
gl: WebGLRenderingContext;
|
|
program: WebGLProgram;
|
|
vertexSrc: string[];
|
|
|
|
destroy(): void;
|
|
init(): void;
|
|
|
|
}
|
|
|
|
export class Point {
|
|
|
|
constructor(x?: number, y?: number);
|
|
|
|
x: number;
|
|
y: number;
|
|
|
|
clone(): Point;
|
|
set(x: number, y: number): void;
|
|
|
|
}
|
|
|
|
export class Polygon implements HitArea {
|
|
|
|
constructor(points: Point[]);
|
|
constructor(points: number[]);
|
|
constructor(...points: Point[]);
|
|
constructor(...points: number[]);
|
|
|
|
points: number[];
|
|
|
|
clone(): Polygon;
|
|
contains(x: number, y: number): boolean;
|
|
|
|
}
|
|
|
|
export class Rectangle implements HitArea {
|
|
|
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
|
|
clone(): Rectangle;
|
|
contains(x: number, y: number): boolean;
|
|
|
|
}
|
|
|
|
export class RGBSplitFilter extends AbstractFilter {
|
|
|
|
red: Point;
|
|
green: Point;
|
|
blue: Point;
|
|
|
|
}
|
|
|
|
export class Rope extends Strip {
|
|
|
|
points: Point[];
|
|
vertices: number[];
|
|
|
|
constructor(texture: Texture, points: Point[]);
|
|
|
|
refresh(): void;
|
|
setTexture(texture: Texture): void;
|
|
|
|
}
|
|
|
|
export class RoundedRectangle implements HitArea {
|
|
|
|
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
|
|
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
radius: number;
|
|
|
|
clone(): RoundedRectangle;
|
|
contains(x: number, y: number): boolean;
|
|
|
|
}
|
|
|
|
export class SepiaFilter extends AbstractFilter {
|
|
|
|
sepia: number;
|
|
|
|
}
|
|
|
|
export class SmartBlurFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
|
|
}
|
|
|
|
export class SpineLoader implements Mixin {
|
|
|
|
url: string;
|
|
crossorigin: boolean;
|
|
loaded: boolean;
|
|
|
|
constructor(url: string, crossOrigin: boolean);
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export class SpineTextureLoader {
|
|
|
|
constructor(basePath: string, crossorigin: boolean);
|
|
|
|
load(page: AtlasPage, file: string): void;
|
|
unload(texture: BaseTexture): void;
|
|
|
|
}
|
|
|
|
export class Sprite extends DisplayObjectContainer {
|
|
|
|
static fromFrame(frameId: string): Sprite;
|
|
static fromImage(url: string, crossorigin?: boolean, scaleMode?: scaleModes): Sprite;
|
|
|
|
constructor(texture: Texture);
|
|
|
|
anchor: Point;
|
|
blendMode: blendModes;
|
|
shader: IPixiShader;
|
|
texture: Texture;
|
|
tint: number;
|
|
|
|
setTexture(texture: Texture): void;
|
|
|
|
}
|
|
|
|
export class SpriteBatch extends DisplayObjectContainer {
|
|
|
|
constructor(texture?: Texture);
|
|
|
|
ready: boolean;
|
|
textureThing: Texture;
|
|
|
|
initWebGL(gl: WebGLRenderingContext): void;
|
|
|
|
}
|
|
|
|
export class SpriteSheetLoader implements Mixin {
|
|
|
|
constructor(url: string, crossorigin?: boolean);
|
|
|
|
baseUrl: string;
|
|
crossorigin: boolean;
|
|
frames: any;
|
|
texture: Texture;
|
|
url: string;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
load(): void;
|
|
|
|
}
|
|
|
|
export class Stage extends DisplayObjectContainer {
|
|
|
|
constructor(backgroundColor: number);
|
|
|
|
interactionManager: InteractionManager;
|
|
|
|
getMousePosition(): Point;
|
|
setBackgroundColor(backgroundColor: number): void;
|
|
setInteractionDelegate(domElement: HTMLElement): void;
|
|
|
|
}
|
|
|
|
export class Strip extends DisplayObjectContainer {
|
|
|
|
static DrawModes: {
|
|
|
|
TRIANGLE_STRIP: number;
|
|
TRIANGLES: number;
|
|
|
|
}
|
|
|
|
constructor(texture: Texture);
|
|
|
|
blendMode: number;
|
|
colors: number[];
|
|
dirty: boolean;
|
|
indices: number[];
|
|
canvasPadding: number;
|
|
texture: Texture;
|
|
uvs: number[];
|
|
vertices: number[];
|
|
|
|
getBounds(matrix?: Matrix): Rectangle;
|
|
|
|
}
|
|
|
|
export class Text extends Sprite {
|
|
|
|
constructor(text: string, style?: TextStyle);
|
|
|
|
context: CanvasRenderingContext2D;
|
|
resolution: number;
|
|
|
|
destroy(destroyTexture: boolean): void;
|
|
setStyle(style: TextStyle): void;
|
|
setText(text: string): void;
|
|
|
|
}
|
|
|
|
export class Texture implements Mixin {
|
|
|
|
static emptyTexture: Texture;
|
|
|
|
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: scaleModes): Texture;
|
|
static fromFrame(frameId: string): Texture;
|
|
static fromImage(imageUrl: string, crossorigin?: boolean, scaleMode?: scaleModes): Texture;
|
|
static addTextureToCache(texture: Texture, id: string): void;
|
|
static removeTextureFromCache(id: string): Texture;
|
|
|
|
constructor(baseTexture: BaseTexture, frame?: Rectangle, crop?: Rectangle, trim?: Rectangle);
|
|
|
|
baseTexture: BaseTexture;
|
|
crop: Rectangle;
|
|
frame: Rectangle;
|
|
height: number;
|
|
noFrame: boolean;
|
|
requiresUpdate: boolean;
|
|
trim: Point;
|
|
width: number;
|
|
scope: any;
|
|
valid: boolean;
|
|
|
|
listeners(eventName: string): Function[];
|
|
emit(eventName: string, data?: any): boolean;
|
|
dispatchEvent(eventName: string, data?: any): boolean;
|
|
on(eventName: string, fn: Function): Function;
|
|
addEventListener(eventName: string, fn: Function): Function;
|
|
once(eventName: string, fn: Function): Function;
|
|
off(eventName: string, fn: Function): Function;
|
|
removeAllEventListeners(eventName: string): void;
|
|
|
|
destroy(destroyBase: boolean): void;
|
|
setFrame(frame: Rectangle): void;
|
|
|
|
}
|
|
|
|
export class TilingSprite extends Sprite {
|
|
|
|
constructor(texture: Texture, width: number, height: number);
|
|
|
|
blendMode: number;
|
|
texture: Texture;
|
|
tint: number;
|
|
tilePosition: Point;
|
|
tileScale: Point;
|
|
tileScaleOffset: Point;
|
|
|
|
generateTilingTexture(forcePowerOfTwo: boolean): void;
|
|
setTexture(texture: Texture): void;
|
|
|
|
}
|
|
|
|
export class TiltShiftFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
gradientBlur: number;
|
|
start: number;
|
|
end: number;
|
|
|
|
}
|
|
|
|
export class TiltShiftXFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
gradientBlur: number;
|
|
start: number;
|
|
end: number;
|
|
|
|
updateDelta(): void;
|
|
|
|
}
|
|
|
|
export class TiltShiftYFilter extends AbstractFilter {
|
|
|
|
blur: number;
|
|
gradientBlur: number;
|
|
start: number;
|
|
end: number;
|
|
|
|
updateDelta(): void;
|
|
|
|
}
|
|
|
|
export class TwistFilter extends AbstractFilter {
|
|
|
|
angle: number;
|
|
offset: Point;
|
|
radius: number;
|
|
|
|
}
|
|
|
|
export class VideoTexture extends BaseTexture {
|
|
|
|
static baseTextureFromVideo(video: HTMLVideoElement, scaleMode: number): BaseTexture;
|
|
static textureFromVideo(video: HTMLVideoElement, scaleMode: number): Texture;
|
|
static fromUrl(videoSrc: string, scaleMode: number): Texture;
|
|
|
|
autoUpdate: boolean;
|
|
|
|
destroy(): void;
|
|
updateBound(): void;
|
|
onPlayStart(): void;
|
|
onPlayStop(): void;
|
|
onCanPlay(): void;
|
|
|
|
}
|
|
|
|
export class WebGLBlendModeManager {
|
|
|
|
currentBlendMode: number;
|
|
|
|
destroy(): void;
|
|
setBlendMode(blendMode: number): boolean;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
}
|
|
|
|
export class WebGLFastSpriteBatch {
|
|
|
|
constructor(gl: CanvasRenderingContext2D);
|
|
|
|
currentBatchSize: number;
|
|
currentBaseTexture: BaseTexture;
|
|
currentBlendMode: number;
|
|
renderSession: RenderSession;
|
|
drawing: boolean;
|
|
indexBuffer: any;
|
|
indices: number[];
|
|
lastIndexCount: number;
|
|
matrix: Matrix;
|
|
maxSize: number;
|
|
shader: IPixiShader;
|
|
size: number;
|
|
vertexBuffer: any;
|
|
vertices: number[];
|
|
vertSize: number;
|
|
|
|
end(): void;
|
|
begin(spriteBatch: SpriteBatch, renderSession: RenderSession): void;
|
|
destroy(removeView?: boolean): void;
|
|
flush(): void;
|
|
render(spriteBatch: SpriteBatch): void;
|
|
renderSprite(sprite: Sprite): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
start(): void;
|
|
stop(): void;
|
|
|
|
}
|
|
|
|
export class WebGLFilterManager {
|
|
|
|
filterStack: AbstractFilter[];
|
|
transparent: boolean;
|
|
offsetX: number;
|
|
offsetY: number;
|
|
|
|
applyFilterPass(filter: AbstractFilter, filterArea: Texture, width: number, height: number): void;
|
|
begin(renderSession: RenderSession, buffer: ArrayBuffer): void;
|
|
destroy(): void;
|
|
initShaderBuffers(): void;
|
|
popFilter(): void;
|
|
pushFilter(filterBlock: FilterBlock): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
}
|
|
|
|
export class WebGLGraphics {
|
|
|
|
static graphicsDataPool: any[];
|
|
|
|
static renderGraphics(graphics: Graphics, renderRession: RenderSession): void;
|
|
static updateGraphics(graphics: Graphics, gl: WebGLRenderingContext): void;
|
|
static switchMode(webGL: WebGLRenderingContext, type: number): any; //WebGLData
|
|
static buildRectangle(graphicsData: GraphicsData, webGLData: any): void;
|
|
static buildRoundedRectangle(graphicsData: GraphicsData, webGLData: any): void;
|
|
static quadraticBezierCurve(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number[];
|
|
static buildCircle(graphicsData: GraphicsData, webGLData: any): void;
|
|
static buildLine(graphicsData: GraphicsData, webGLData: any): void;
|
|
static buildComplexPoly(graphicsData: GraphicsData, webGLData: any): void;
|
|
static buildPoly(graphicsData: GraphicsData, webGLData: any): boolean;
|
|
|
|
reset(): void;
|
|
upload(): void;
|
|
|
|
}
|
|
|
|
export class WebGLGraphicsData {
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
gl: WebGLRenderingContext;
|
|
glPoints: any[];
|
|
color: number[];
|
|
points: any[];
|
|
indices: any[];
|
|
buffer: WebGLBuffer;
|
|
indexBuffer: WebGLBuffer;
|
|
mode: number;
|
|
alpha: number;
|
|
dirty: boolean;
|
|
|
|
reset(): void;
|
|
upload(): void;
|
|
|
|
}
|
|
|
|
export class WebGLMaskManager {
|
|
|
|
destroy(): void;
|
|
popMask(renderSession: RenderSession): void;
|
|
pushMask(maskData: any[], renderSession: RenderSession): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
}
|
|
|
|
export class WebGLRenderer implements PixiRenderer {
|
|
|
|
static createWebGLTexture(texture: Texture, gl: WebGLRenderingContext): void;
|
|
|
|
constructor(width?: number, height?: number, options?: PixiRendererOptions);
|
|
|
|
autoResize: boolean;
|
|
clearBeforeRender: boolean;
|
|
contextLost: boolean;
|
|
contextLostBound: Function;
|
|
contextRestoreLost: boolean;
|
|
contextRestoredBound: Function;
|
|
height: number;
|
|
gl: WebGLRenderingContext;
|
|
offset: Point;
|
|
preserveDrawingBuffer: boolean;
|
|
projection: Point;
|
|
resolution: number;
|
|
renderSession: RenderSession;
|
|
shaderManager: WebGLShaderManager;
|
|
spriteBatch: WebGLSpriteBatch;
|
|
maskManager: WebGLMaskManager;
|
|
filterManager: WebGLFilterManager;
|
|
stencilManager: WebGLStencilManager;
|
|
blendModeManager: WebGLBlendModeManager;
|
|
transparent: boolean;
|
|
type: number;
|
|
view: HTMLCanvasElement;
|
|
width: number;
|
|
|
|
destroy(): void;
|
|
initContext(): void;
|
|
mapBlendModes(): void;
|
|
render(stage: Stage): void;
|
|
renderDisplayObject(displayObject: DisplayObject, projection: Point, buffer: WebGLBuffer): void;
|
|
resize(width: number, height: number): void;
|
|
updateTexture(texture: Texture): void;
|
|
|
|
}
|
|
|
|
export class WebGLShaderManager {
|
|
|
|
maxAttibs: number;
|
|
attribState: any[];
|
|
stack: any[];
|
|
tempAttribState: any[];
|
|
|
|
destroy(): void;
|
|
setAttribs(attribs: ShaderAttribute[]): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
setShader(shader: IPixiShader): boolean;
|
|
|
|
}
|
|
|
|
export class WebGLStencilManager {
|
|
|
|
stencilStack: any[];
|
|
reverse: boolean;
|
|
count: number;
|
|
|
|
bindGraphics(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
destroy(): void;
|
|
popStencil(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
pushStencil(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
}
|
|
|
|
export class WebGLSpriteBatch {
|
|
|
|
blendModes: number[];
|
|
colors: number[];
|
|
currentBatchSize: number;
|
|
currentBaseTexture: Texture;
|
|
defaultShader: AbstractFilter;
|
|
dirty: boolean;
|
|
drawing: boolean;
|
|
indices: number[];
|
|
lastIndexCount: number;
|
|
positions: number[];
|
|
textures: Texture[];
|
|
shaders: IPixiShader[];
|
|
size: number;
|
|
sprites: any[]; //todo Sprite[]?
|
|
vertices: number[];
|
|
vertSize: number;
|
|
|
|
begin(renderSession: RenderSession): void;
|
|
destroy(): void;
|
|
end(): void;
|
|
flush(shader?: IPixiShader): void;
|
|
render(sprite: Sprite): void;
|
|
renderBatch(texture: Texture, size: number, startIndex: number): void;
|
|
renderTilingSprite(sprite: TilingSprite): void;
|
|
setBlendMode(blendMode: blendModes): void;
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
start(): void;
|
|
stop(): void;
|
|
|
|
}
|
|
|
|
export class RenderTexture extends Texture {
|
|
|
|
constructor(width?: number, height?: number, renderer?: PixiRenderer, scaleMode?: scaleModes, resolution?: number);
|
|
|
|
frame: Rectangle;
|
|
baseTexture: BaseTexture;
|
|
renderer: PixiRenderer;
|
|
resolution: number;
|
|
valid: boolean;
|
|
|
|
clear(): void;
|
|
getBase64(): string;
|
|
getCanvas(): HTMLCanvasElement;
|
|
getImage(): HTMLImageElement;
|
|
resize(width: number, height: number, updateBase: boolean): void;
|
|
render(displayObject: DisplayObject, position?: Point, clear?: boolean): void;
|
|
|
|
}
|
|
|
|
//SPINE
|
|
|
|
export class BoneData {
|
|
|
|
constructor(name: string, parent?: any);
|
|
|
|
name: string;
|
|
parent: any;
|
|
length: number;
|
|
x: number;
|
|
y: number;
|
|
rotation: number;
|
|
scaleX: number;
|
|
scaleY: number;
|
|
|
|
}
|
|
|
|
export class SlotData {
|
|
|
|
constructor(name: string, boneData: BoneData);
|
|
|
|
name: string;
|
|
boneData: BoneData;
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
attachmentName: string;
|
|
|
|
}
|
|
|
|
export class Bone {
|
|
|
|
constructor(boneData: BoneData, parent?: any);
|
|
|
|
data: BoneData;
|
|
parent: any;
|
|
yDown: boolean;
|
|
x: number;
|
|
y: number;
|
|
rotation: number;
|
|
scaleX: number;
|
|
scaleY: number;
|
|
worldRotation: number;
|
|
worldScaleX: number;
|
|
worldScaleY: number;
|
|
|
|
updateWorldTransform(flipX: boolean, flip: boolean): void;
|
|
setToSetupPose(): void;
|
|
|
|
}
|
|
|
|
export class Slot {
|
|
|
|
constructor(slotData: SlotData, skeleton: Skeleton, bone: Bone);
|
|
|
|
data: SlotData;
|
|
skeleton: Skeleton;
|
|
bone: Bone;
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
attachment: RegionAttachment;
|
|
setAttachment(attachment: RegionAttachment): void;
|
|
setAttachmentTime(time: number): void;
|
|
getAttachmentTime(): number;
|
|
setToSetupPose(): void;
|
|
|
|
}
|
|
|
|
export class Skin {
|
|
|
|
constructor(name: string);
|
|
|
|
name: string;
|
|
attachments: any;
|
|
|
|
addAttachment(slotIndex: number, name: string, attachment: RegionAttachment): void;
|
|
getAttachment(slotIndex: number, name: string): void;
|
|
|
|
}
|
|
|
|
export class Animation {
|
|
|
|
constructor(name: string, timelines: ISpineTimeline[], duration: number);
|
|
|
|
name: string;
|
|
timelines: ISpineTimeline[];
|
|
duration: number;
|
|
apply(skeleton: Skeleton, time: number, loop: boolean): void;
|
|
min(skeleton: Skeleton, time: number, loop: boolean, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class Curves {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: number[];
|
|
|
|
setLinear(frameIndex: number): void;
|
|
setStepped(frameIndex: number): void;
|
|
setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
|
|
getCurvePercent(frameIndex: number, percent: number): number;
|
|
|
|
}
|
|
|
|
export interface ISpineTimeline {
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
|
|
getFrameCount(): number;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class RotateTimeline implements ISpineTimeline {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
boneIndex: number;
|
|
|
|
getFrameCount(): number;
|
|
setFrame(frameIndex: number, time: number, angle: number): void;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class TranslateTimeline implements ISpineTimeline {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
boneIndex: number;
|
|
|
|
getFrameCount(): number;
|
|
setFrame(frameIndex: number, time: number, x: number, y: number): void;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class ScaleTimeline implements ISpineTimeline {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
boneIndex: number;
|
|
|
|
getFrameCount(): number;
|
|
setFrame(frameIndex: number, time: number, x: number, y: number): void;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class ColorTimeline implements ISpineTimeline {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
boneIndex: number;
|
|
|
|
getFrameCount(): number;
|
|
setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class AttachmentTimeline implements ISpineTimeline {
|
|
|
|
constructor(frameCount: number);
|
|
|
|
curves: Curves;
|
|
frames: number[];
|
|
attachmentNames: string[];
|
|
slotIndex: number;
|
|
|
|
getFrameCount(): number;
|
|
setFrame(frameIndex: number, time: number, attachmentName: string): void;
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
}
|
|
|
|
export class SkeletonData {
|
|
|
|
bones: Bone[];
|
|
slots: Slot[];
|
|
skins: Skin[];
|
|
animations: Animation[];
|
|
defaultSkin: Skin;
|
|
|
|
findBone(boneName: string): Bone;
|
|
findBoneIndex(boneName: string): number;
|
|
findSlot(slotName: string): Slot;
|
|
findSlotIndex(slotName: string): number;
|
|
findSkin(skinName: string): Skin;
|
|
findAnimation(animationName: string): Animation;
|
|
|
|
}
|
|
|
|
export class Skeleton {
|
|
|
|
constructor(skeletonData: SkeletonData);
|
|
|
|
data: SkeletonData;
|
|
bones: Bone[];
|
|
slots: Slot[];
|
|
drawOrder: any[];
|
|
x: number;
|
|
y: number;
|
|
skin: Skin;
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
time: number;
|
|
flipX: boolean;
|
|
flipY: boolean;
|
|
|
|
updateWorldTransform(): void;
|
|
setToSetupPose(): void;
|
|
setBonesToSetupPose(): void;
|
|
setSlotsToSetupPose(): void;
|
|
getRootBone(): Bone;
|
|
findBone(boneName: string): Bone;
|
|
fineBoneIndex(boneName: string): number;
|
|
findSlot(slotName: string): Slot;
|
|
findSlotIndex(slotName: string): number;
|
|
setSkinByName(skinName: string): void;
|
|
setSkin(newSkin: Skin): void;
|
|
getAttachmentBySlotName(slotName: string, attachmentName: string): RegionAttachment;
|
|
getAttachmentBySlotIndex(slotIndex: number, attachmentName: string): RegionAttachment;
|
|
setAttachment(slotName: string, attachmentName: string): void;
|
|
update(data: number): void;
|
|
|
|
}
|
|
|
|
export class RegionAttachment {
|
|
|
|
offset: number[];
|
|
uvs: number[];
|
|
x: number;
|
|
y: number;
|
|
rotation: number;
|
|
scaleX: number;
|
|
scaleY: number;
|
|
width: number;
|
|
height: number;
|
|
rendererObject: any;
|
|
regionOffsetX: number;
|
|
regionOffsetY: number;
|
|
regionWidth: number;
|
|
regionHeight: number;
|
|
regionOriginalWidth: number;
|
|
regionOriginalHeight: number;
|
|
|
|
setUVs(u: number, v: number, u2: number, v2: number, rotate: number): void;
|
|
updateOffset(): void;
|
|
computeVertices(x: number, y: number, bone: Bone, vertices: number[]): void;
|
|
|
|
}
|
|
|
|
export class AnimationStateData {
|
|
|
|
constructor(skeletonData: SkeletonData);
|
|
|
|
skeletonData: SkeletonData;
|
|
animationToMixTime: any;
|
|
defaultMix: number;
|
|
|
|
setMixByName(fromName: string, toName: string, duration: number): void;
|
|
setMix(from: string, to: string): number;
|
|
|
|
}
|
|
|
|
export class AnimationState {
|
|
|
|
constructor(stateData: any);
|
|
|
|
animationSpeed: number;
|
|
current: any;
|
|
previous: any;
|
|
currentTime: number;
|
|
previousTime: number;
|
|
currentLoop: boolean;
|
|
previousLoop: boolean;
|
|
mixTime: number;
|
|
mixDuration: number;
|
|
queue: Animation[];
|
|
|
|
update(delta: number): void;
|
|
apply(skeleton: any): void;
|
|
clearAnimation(): void;
|
|
setAnimation(animation: any, loop: boolean): void;
|
|
setAnimationByName(animationName: string, loop: boolean): void;
|
|
addAnimationByName(animationName: string, loop: boolean, delay: number): void;
|
|
addAnimation(animation: any, loop: boolean, delay: number): void;
|
|
isComplete(): number;
|
|
|
|
}
|
|
|
|
export class SkeletonJson {
|
|
|
|
constructor(attachmentLoader: AtlasAttachmentLoader);
|
|
|
|
attachmentLoader: AtlasAttachmentLoader;
|
|
scale: number;
|
|
|
|
readSkeletonData(root: any): SkeletonData;
|
|
readAttachment(skin: Skin, name: string, map: any): RegionAttachment;
|
|
readAnimation(name: string, map: any, skeletonData: SkeletonData): void;
|
|
readCurve(timeline: ISpineTimeline, frameIndex: number, valueMap: any): void;
|
|
toColor(hexString: string, colorIndex: number): number;
|
|
|
|
}
|
|
|
|
export class Atlas {
|
|
|
|
static FORMAT: {
|
|
|
|
alpha: number;
|
|
intensity: number;
|
|
luminanceAlpha: number;
|
|
rgb565: number;
|
|
rgba4444: number;
|
|
rgb888: number;
|
|
rgba8888: number;
|
|
|
|
}
|
|
|
|
static TextureFilter: {
|
|
|
|
nearest: number;
|
|
linear: number;
|
|
mipMap: number;
|
|
mipMapNearestNearest: number;
|
|
mipMapLinearNearest: number;
|
|
mipMapNearestLinear: number;
|
|
mipMapLinearLinear: number;
|
|
|
|
}
|
|
|
|
static textureWrap: {
|
|
|
|
mirroredRepeat: number;
|
|
clampToEdge: number;
|
|
repeat: number;
|
|
|
|
}
|
|
|
|
constructor(atlasText: string, textureLoader: AtlasLoader);
|
|
|
|
textureLoader: AtlasLoader;
|
|
pages: AtlasPage[];
|
|
regions: AtlasRegion[];
|
|
|
|
findRegion(name: string): AtlasRegion;
|
|
dispose(): void;
|
|
updateUVs(page: AtlasPage): void;
|
|
|
|
}
|
|
|
|
export class AtlasPage {
|
|
|
|
name: string;
|
|
format: number;
|
|
minFilter: number;
|
|
magFilter: number;
|
|
uWrap: number;
|
|
vWrap: number;
|
|
rendererObject: any;
|
|
width: number;
|
|
height: number;
|
|
|
|
}
|
|
|
|
export class AtlasRegion {
|
|
|
|
page: AtlasPage;
|
|
name: string;
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
u: number;
|
|
v: number;
|
|
u2: number;
|
|
v2: number;
|
|
offsetX: number;
|
|
offsetY: number;
|
|
originalWidth: number;
|
|
originalHeight: number;
|
|
index: number;
|
|
rotate: boolean;
|
|
splits: any[];
|
|
pads: any[];
|
|
|
|
}
|
|
|
|
export class AtlasReader {
|
|
|
|
constructor(text: string);
|
|
|
|
lines: string[];
|
|
index: number;
|
|
|
|
trim(value: string): string;
|
|
readLine(): string;
|
|
readValue(): string;
|
|
readTuple(tuple: number): number;
|
|
|
|
}
|
|
|
|
export class AtlasAttachmentLoader {
|
|
|
|
constructor(atlas: Atlas);
|
|
|
|
atlas: Atlas;
|
|
|
|
newAttachment(skin: Skin, type: number, name: string): RegionAttachment;
|
|
|
|
}
|
|
|
|
export class Spine extends DisplayObjectContainer {
|
|
|
|
constructor(url: string);
|
|
|
|
autoUpdate: boolean;
|
|
spineData: any;
|
|
skeleton: Skeleton;
|
|
stateData: AnimationStateData;
|
|
state: AnimationState;
|
|
slotContainers: DisplayObjectContainer[];
|
|
|
|
createSprite(slot: Slot, descriptor: { name: string }): Sprite[];
|
|
update(dt: number): void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
declare function requestAnimFrame(callback: Function): void;
|
|
|
|
declare module PIXI.PolyK {
|
|
export function Triangulate(p: number[]): number[];
|
|
}
|