UNPKG

dragonbones-pixijs

Version:
314 lines (313 loc) 9.94 kB
import { IAnimatable } from "../animation/IAnimatable"; import { WorldClock } from "../animation/WorldClock"; import { BaseObject } from "../core/BaseObject"; import { DragonBones } from "../core/DragonBones"; import { EventObject } from "../event/EventObject"; import { IEventDispatcher } from "../event/IEventDispatcher"; import { ArmatureData } from "../model/ArmatureData"; import { TextureAtlasData } from "../model/TextureAtlasData"; import { Bone } from "./Bone"; import { Constraint } from "./Constraint"; import { IArmatureProxy } from "./IArmatureProxy"; import { Slot } from "./Slot"; import { Animation } from "../animation/Animation"; /** * - Armature is the core of the skeleton animation system. * @see dragonBones.ArmatureData * @see dragonBones.Bone * @see dragonBones.Slot * @see dragonBones.Animation * @version DragonBones 3.0 * @language en_US */ export declare class Armature extends BaseObject implements IAnimatable { static toString(): string; private static _onSortSlots; /** * - Whether to inherit the animation control of the parent armature. * True to try to have the child armature play an animation with the same name when the parent armature play the animation. * @default true * @version DragonBones 4.5 * @language en_US */ inheritAnimation: boolean; /** * @private */ userData: any; /** * @internal */ _lockUpdate: boolean; private _slotsDirty; private _zOrderDirty; /** * @internal */ _zIndexDirty: boolean; /** * @internal */ _alphaDirty: boolean; private _flipX; private _flipY; /** * @internal */ _cacheFrameIndex: number; private _alpha; /** * @internal */ _globalAlpha: number; private readonly _bones; private readonly _slots; /** * @internal */ readonly _constraints: Array<Constraint>; private readonly _actions; /** * @internal */ _armatureData: ArmatureData; private _animation; private _proxy; private _display; /** * @internal */ _replaceTextureAtlasData: TextureAtlasData | null; private _replacedTexture; /** * @internal */ _dragonBones: DragonBones; private _clock; /** * @internal */ _parent: Slot | null; protected _onClear(): void; /** * @internal */ _sortZOrder(slotIndices: Array<number> | Int16Array | null, offset: number): void; /** * @internal */ _addBone(value: Bone): void; /** * @internal */ _addSlot(value: Slot): void; /** * @internal */ _addConstraint(value: Constraint): void; /** * @internal */ _bufferAction(action: EventObject, append: boolean): void; /** * - Dispose the armature. (Return to the object pool) * @example * <pre> * removeChild(armature.display); * armature.dispose(); * </pre> * @version DragonBones 3.0 * @language en_US */ dispose(): void; /** * @internal */ init(armatureData: ArmatureData, proxy: IArmatureProxy, display: any, dragonBones: DragonBones): void; /** * @inheritDoc */ advanceTime(passedTime: number): void; /** * - Forces a specific bone or its owning slot to update the transform or display property in the next frame. * @param boneName - The bone name. (If not set, all bones will be update) * @param updateSlot - Whether to update the bone's slots. (Default: false) * @see dragonBones.Bone#invalidUpdate() * @see dragonBones.Slot#invalidUpdate() * @version DragonBones 3.0 * @language en_US */ invalidUpdate(boneName?: string | null, updateSlot?: boolean): void; /** * - Check whether a specific point is inside a custom bounding box in a slot. * The coordinate system of the point is the inner coordinate system of the armature. * Custom bounding boxes need to be customized in Dragonbones Pro. * @param x - The horizontal coordinate of the point. * @param y - The vertical coordinate of the point. * @version DragonBones 5.0 * @language en_US */ containsPoint(x: number, y: number): Slot | null; /** * - Check whether a specific segment intersects a custom bounding box for a slot in the armature. * The coordinate system of the segment and intersection is the inner coordinate system of the armature. * Custom bounding boxes need to be customized in Dragonbones Pro. * @param xA - The horizontal coordinate of the beginning of the segment. * @param yA - The vertical coordinate of the beginning of the segment. * @param xB - The horizontal coordinate of the end point of the segment. * @param yB - The vertical coordinate of the end point of the segment. * @param intersectionPointA - The first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated) * @param intersectionPointB - The first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated) * @param normalRadians - The normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated) * @returns The slot of the first custom bounding box where the segment intersects from the start point to the end point. * @version DragonBones 5.0 * @language en_US */ intersectsSegment(xA: number, yA: number, xB: number, yB: number, intersectionPointA?: { x: number; y: number; } | null, intersectionPointB?: { x: number; y: number; } | null, normalRadians?: { x: number; y: number; } | null): Slot | null; /** * - Get a specific bone. * @param name - The bone name. * @see dragonBones.Bone * @version DragonBones 3.0 * @language en_US */ getBone(name: string): Bone | null; /** * - Get a specific bone by the display. * @param display - The display object. * @see dragonBones.Bone * @version DragonBones 3.0 * @language en_US */ getBoneByDisplay(display: any): Bone | null; /** * - Get a specific slot. * @param name - The slot name. * @see dragonBones.Slot * @version DragonBones 3.0 * @language en_US */ getSlot(name: string): Slot | null; /** * - Get a specific slot by the display. * @param display - The display object. * @see dragonBones.Slot * @version DragonBones 3.0 * @language en_US */ getSlotByDisplay(display: any): Slot | null; /** * - Get all bones. * @see dragonBones.Bone * @version DragonBones 3.0 * @language en_US */ getBones(): Array<Bone>; /** * - Get all slots. * @see dragonBones.Slot * @version DragonBones 3.0 * @language en_US */ getSlots(): Array<Slot>; /** * - Whether to flip the armature horizontally. * @version DragonBones 5.5 * @language en_US */ get flipX(): boolean; set flipX(value: boolean); /** * - Whether to flip the armature vertically. * @version DragonBones 5.5 * @language en_US */ get flipY(): boolean; set flipY(value: boolean); /** * - The animation cache frame rate, which turns on the animation cache when the set value is greater than 0. * There is a certain amount of memory overhead to improve performance by caching animation data in memory. * The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate. * When the animation cache is turned on, some features will fail, such as the offset property of bone. * @example * <pre> * armature.cacheFrameRate = 24; * </pre> * @see dragonBones.DragonBonesData#frameRate * @see dragonBones.ArmatureData#frameRate * @version DragonBones 4.5 * @language en_US */ get cacheFrameRate(): number; set cacheFrameRate(value: number); /** * - The armature name. * @version DragonBones 3.0 * @language en_US */ get name(): string; /** * - The armature data. * @see dragonBones.ArmatureData * @version DragonBones 4.5 * @language en_US */ get armatureData(): ArmatureData; /** * - The animation player. * @see dragonBones.Animation * @version DragonBones 3.0 * @language en_US */ get animation(): Animation; /** * @pivate */ get proxy(): IArmatureProxy; /** * - The EventDispatcher instance of the armature. * @version DragonBones 4.5 * @language en_US */ get eventDispatcher(): IEventDispatcher; /** * - The display container. * The display of the slot is displayed as the parent. * Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type. * @version DragonBones 3.0 * @language en_US */ get display(): any; /** * @private */ get replacedTexture(): any; set replacedTexture(value: any); /** * @inheritDoc */ get clock(): WorldClock | null; set clock(value: WorldClock | null); /** * - Get the parent slot which the armature belongs to. * @see dragonBones.Slot * @version DragonBones 4.5 * @language en_US */ get parent(): Slot | null; /** * - Deprecated, please refer to {@link #display}. * @deprecated * @language en_US */ getDisplay(): any; }