import * as _drincs_pixi_vn_spine_core from '@drincs/pixi-vn-spine/core'; import { SpineFromOptions, TrackEntry, SpineOptions as SpineOptions$1, Spine as Spine$1 } from '@drincs/pixi-vn-spine/core'; import { ContainerOptions, CanvasBaseItemMemory, ListenerExtensionMemory, AdditionalPositionsExtensionProps, AnchorExtensionProps, CanvasBaseItem, AnchorExtension, ListenerExtension, AdditionalPositionsExtension, OnEventsHandlers } from '@drincs/pixi-vn'; import { SequenceOptions, AnimationPlaybackControlsWithThen } from 'motion'; import { ContainerEvents, ContainerChild, EventEmitter, PointData, ObservablePoint } from 'pixi.js'; import { AnimationOptionsCommon } from '@drincs/pixi-vn/motion'; interface SpineOptions extends Omit, Omit { } type SpineSequenceOptions = Pick & { /** * Whether the animation should loop. If true, the animation will loop indefinitely until changed. */ loop?: boolean; /** * Delay in seconds before the animation starts. If not provided, the animation will start immediately after the previous animation on the track, or after the mix duration if there is a previous animation. * If > 0, sets TrackEntry#delay. If <= 0, the delay set is the duration of the previous track entry * minus any mix duration (from the AnimationStateData) plus the specified `delay` (ie the mix * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the * previous entry is looping, its next loop completion is used instead of its duration. */ delay?: number; }; interface TrackMemory extends Omit, "animation"> { animationName: string; } interface MemoryCore extends Omit { } interface SpineMemory extends MemoryCore, CanvasBaseItemMemory, ListenerExtensionMemory, AdditionalPositionsExtensionProps, AnchorExtensionProps, Omit { state: { tracks: (TrackMemory | null)[]; }; currentSkin?: string; sequenceTimelines: { [track: number]: { sequence: ([string, SpineSequenceOptions] | string)[]; options: SequenceOptions & { completeOnContinue?: boolean; }; }; }; } /** * Spine component for Pixi.js, used to display Spine components. * @example * ```ts * import { Assets, canvas } from "@drincs/pixi-vn"; * import { Spine } from "@drincs/pixi-vn-spine"; * * await Assets.load([ * { * alias: "spineSkeleton", * src: "https://raw.githubusercontent.com/pixijs/spine-v8/main/examples/assets/spineboy-pro.skel", * }, * { * alias: "spineAtlas", * src: "https://raw.githubusercontent.com/pixijs/spine-v8/main/examples/assets/spineboy-pma.atlas", * }, * ]); * * const spine = new Spine({ atlas: "spineAtlas", skeleton: "spineSkeleton" }); * spine.x = canvas.width / 2; * spine.y = canvas.height; * * canvas.add("spine", spine); * ``` */ declare class Spine extends Spine$1 implements CanvasBaseItem, AnchorExtension, ListenerExtension, AdditionalPositionsExtension { constructor(options: SpineOptions); readonly pixivnId: string; readonly skeletonAlias: SpineOptions["skeleton"]; readonly atlasAlias: SpineOptions["atlas"]; readonly darkTintCore: SpineOptions["darkTint"]; private sequenceTimelines; get memory(): SpineMemory; setMemory(memory: SpineMemory): Promise; /** * Set a current track with the given animation configuration. * @param trackIndex The track index to set the animation on. * @param animationName The name of the animation to set. * @param options Additional options for setting the animation. */ setAnimation(animationName: string, options: { /** * The track index to play the animation on. */ trackIndex: number; /** * Whether the animation should loop. If true, the animation will loop indefinitely until changed. */ loop?: boolean; /** * If true, the animation will be completed before the next step. * @default true */ completeOnContinue?: boolean; }): _drincs_pixi_vn_spine_core.TrackEntry; /** * Add an animation to a track with the given animation configuration. * @param animationName The name of the animation to play. * @param options Additional options for playing the track. */ addAnimation(animationName: string, options?: { /** * Whether the animation should loop. If true, the animation will loop indefinitely until changed. */ loop?: boolean; /** * Delay in seconds before the animation starts. If not provided, the animation will start immediately after the previous animation on the track, or after the mix duration if there is a previous animation. * If > 0, sets TrackEntry#delay. If <= 0, the delay set is the duration of the previous track entry * minus any mix duration (from the AnimationStateData) plus the specified `delay` (ie the mix * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the * previous entry is looping, its next loop completion is used instead of its duration. */ delay?: number; /** * The track index to play the animation on. */ trackIndex?: number; /** * If true, the animation will be completed before the next step. * @default true */ completeOnContinue?: boolean; }): _drincs_pixi_vn_spine_core.TrackEntry; /** * Play a sequence of animations on a track, with the given animation configuration. * @param sequence The sequence of animations to play, with their respective options. Corresponds to the motion sequence settings: https://motion.dev/docs/animate#timeline-sequences * @param options Additional options for playing the track. * @example * ```ts * spine.playTrack([ * ["walk", { loop: true, duration: 2 }], * ["jump", { delay: 0.5 }], * ], { loop: true, completeOnContinue: true }); * ``` */ playSequence(sequence: ([string, SpineSequenceOptions] | string)[], options?: SequenceOptions & { /** * If true, the animation will be completed before the next step. * @default true */ completeOnContinue?: boolean; /** * The track index to play the animation on. */ trackIndex?: number; }): Omit; private setTrackSequence; /** * Removes all animations from all tracks, leaving skeletons in their current pose. */ clearTracks(): void; /** * Removes a track by index, leaving skeletons in their current pose. * @param trackIndex The track index to clear. Removes all animations from the track, leaving skeletons in their current pose. */ clearTrack(trackIndex: number): void; /** * Set the skin of the spine sprite. * @param skinName The name of the skin. */ setSkin(skinName: string): void; /** ListenerExtension */ readonly onEventsHandlers: OnEventsHandlers; on | keyof { [K: symbol]: any; [K: {} & string]: any; }>(event: T, fn: (...args: [ ...EventEmitter.ArgumentMap & { [K: symbol]: any; [K: {} & string]: any; }>[Extract | keyof { [K: symbol]: any; [K: {} & string]: any; }>], typeof this ]) => void, context?: any): this; /** Anchor */ private _anchor?; get anchor(): PointData; set anchor(value: PointData | number); protected reloadAnchor(): void; get pivot(): ObservablePoint; set pivot(value: ObservablePoint); /** AdditionalPositions */ private _align; set align(value: Partial | number); get align(): Partial | number; set xAlign(value: number); get xAlign(): number; set yAlign(value: number); get yAlign(): number; private _percentagePosition; set percentagePosition(value: Partial | number); get percentagePosition(): Partial | number; set percentageX(_value: number); get percentageX(): number; set percentageY(_value: number); get percentageY(): number; get positionType(): "pixel" | "percentage" | "align"; get positionInfo(): { x: number; y: number; type: "pixel" | "percentage" | "align"; }; set positionInfo(value: { x: number; y: number; type?: "pixel" | "percentage" | "align"; }); protected reloadPosition(): void; get position(): ObservablePoint; set position(value: ObservablePoint); get x(): number; set x(value: number); get y(): number; set y(value: number); } export { Spine };