UNPKG

dragonbones-pixijs

Version:
323 lines (322 loc) 8.84 kB
import { BaseObject } from "../core/BaseObject"; import { AnimationBlendType } from "../core/DragonBones"; import { AnimationConfig } from "../model/AnimationConfig"; import { AnimationData, TimelineData } from "../model/AnimationData"; import { ActionTimelineState } from "./TimelineState"; import { Armature } from "../armature/Armature"; /** * - The animation state is generated when the animation data is played. * @see dragonBones.Animation * @see dragonBones.AnimationData * @version DragonBones 3.0 * @language en_US */ export declare class AnimationState extends BaseObject { static toString(): string; /** * @private */ actionEnabled: boolean; /** * @private */ additive: boolean; /** * - Whether the animation state has control over the display object properties of the slots. * Sometimes blend a animation state does not want it to control the display object properties of the slots, * especially if other animation state are controlling the display object properties of the slots. * @default true * @version DragonBones 5.0 * @language en_US */ displayControl: boolean; /** * - Whether to reset the objects without animation to the armature pose when the animation state is start to play. * This property should usually be set to false when blend multiple animation states. * @default true * @version DragonBones 5.1 * @language en_US */ resetToPose: boolean; /** * @private */ blendType: AnimationBlendType; /** * - The play times. [0: Loop play, [1~N]: Play N times] * @version DragonBones 3.0 * @language en_US */ playTimes: number; /** * - The blend layer. * High layer animation state will get the blend weight first. * When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned. * @readonly * @version DragonBones 5.0 * @language en_US */ layer: number; /** * - The play speed. * The value is an overlay relationship with {@link dragonBones.Animation#timeScale}. * [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play] * @default 1.0 * @version DragonBones 3.0 * @language en_US */ timeScale: number; /** * @private */ parameterX: number; /** * @private */ parameterY: number; /** * @private */ positionX: number; /** * @private */ positionY: number; /** * - The auto fade out time when the animation state play completed. * [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds) * @default -1.0 * @version DragonBones 5.0 * @language en_US */ autoFadeOutTime: number; /** * @private */ fadeTotalTime: number; /** * - The name of the animation state. (Can be different from the name of the animation data) * @readonly * @version DragonBones 5.0 * @language en_US */ name: string; /** * - The blend group name of the animation state. * This property is typically used to specify the substitution of multiple animation states blend. * @readonly * @version DragonBones 5.0 * @language en_US */ group: string; private _timelineDirty; /** * - xx: Play Enabled, Fade Play Enabled * @internal */ _playheadState: number; /** * -1: Fade in, 0: Fade complete, 1: Fade out; * @internal */ _fadeState: number; /** * -1: Fade start, 0: Fading, 1: Fade complete; * @internal */ _subFadeState: number; /** * @internal */ _position: number; /** * @internal */ _duration: number; private _weight; private _fadeTime; private _time; /** * @internal */ _fadeProgress: number; /** * @internal */ _weightResult: number; private readonly _boneMask; private readonly _boneTimelines; private readonly _boneBlendTimelines; private readonly _slotTimelines; private readonly _slotBlendTimelines; private readonly _constraintTimelines; private readonly _animationTimelines; private readonly _poseTimelines; private _animationData; private _armature; /** * @internal */ _actionTimeline: ActionTimelineState; private _zOrderTimeline; private _activeChildA; private _activeChildB; /** * @internal */ _parent: AnimationState | null; protected _onClear(): void; private _updateTimelines; private _updateBoneAndSlotTimelines; private _advanceFadeTime; /** * @internal */ init(armature: Armature, animationData: AnimationData, animationConfig: AnimationConfig): void; /** * @internal */ advanceTime(passedTime: number, cacheFrameRate: number): void; /** * - Continue play. * @version DragonBones 3.0 * @language en_US */ play(): void; /** * - Stop play. * @version DragonBones 3.0 * @language en_US */ stop(): void; /** * - Fade out the animation state. * @param fadeOutTime - The fade out time. (In seconds) * @param pausePlayhead - Whether to pause the animation playing when fade out. * @version DragonBones 3.0 * @language en_US */ fadeOut(fadeOutTime: number, pausePlayhead?: boolean): void; /** * - Check if a specific bone mask is included. * @param boneName - The bone name. * @version DragonBones 3.0 * @language en_US */ containsBoneMask(boneName: string): boolean; /** * - Add a specific bone mask. * @param boneName - The bone name. * @param recursive - Whether or not to add a mask to the bone's sub-bone. * @version DragonBones 3.0 * @language en_US */ addBoneMask(boneName: string, recursive?: boolean): void; /** * - Remove the mask of a specific bone. * @param boneName - The bone name. * @param recursive - Whether to remove the bone's sub-bone mask. * @version DragonBones 3.0 * @language en_US */ removeBoneMask(boneName: string, recursive?: boolean): void; /** * - Remove all bone masks. * @version DragonBones 3.0 * @language en_US */ removeAllBoneMask(): void; /** * @private */ addState(animationState: AnimationState, timelineDatas?: TimelineData[] | null): void; /** * @internal */ activeTimeline(): void; /** * - Whether the animation state is fading in. * @version DragonBones 5.1 * @language en_US */ get isFadeIn(): boolean; /** * - Whether the animation state is fading out. * @version DragonBones 5.1 * @language en_US */ get isFadeOut(): boolean; /** * - Whether the animation state is fade completed. * @version DragonBones 5.1 * @language en_US */ get isFadeComplete(): boolean; /** * - Whether the animation state is playing. * @version DragonBones 3.0 * @language en_US */ get isPlaying(): boolean; /** * - Whether the animation state is play completed. * @version DragonBones 3.0 * @language en_US */ get isCompleted(): boolean; /** * - The times has been played. * @version DragonBones 3.0 * @language en_US */ get currentPlayTimes(): number; /** * - The total time. (In seconds) * @version DragonBones 3.0 * @language en_US */ get totalTime(): number; /** * - The time is currently playing. (In seconds) * @version DragonBones 3.0 * @language en_US */ get currentTime(): number; set currentTime(value: number); /** * - The blend weight. * @default 1.0 * @version DragonBones 5.0 * @language en_US */ get weight(): number; set weight(value: number); /** * - The animation data. * @see dragonBones.AnimationData * @version DragonBones 3.0 * @language en_US */ get animationData(): AnimationData; } /** * @internal */ export declare class BlendState extends BaseObject { static readonly BONE_TRANSFORM: string; static readonly BONE_ALPHA: string; static readonly SURFACE: string; static readonly SLOT_DEFORM: string; static readonly SLOT_ALPHA: string; static readonly SLOT_Z_INDEX: string; static toString(): string; dirty: number; layer: number; leftWeight: number; layerWeight: number; blendWeight: number; target: BaseObject; protected _onClear(): void; update(animationState: AnimationState): boolean; reset(): void; }