UNPKG

@nativescript/rive

Version:
125 lines (124 loc) 3.89 kB
import { Property, View } from '@nativescript/core'; export declare enum TypeRiveLoop { ONESHOT = 0, LOOP = 1, PINGPONG = 2, AUTO = 3, NONE = 4 } export declare enum TypeRiveDirection { BACKWARDS = 0, FORWARDS = 1, AUTO = 2 } export declare enum TypeRiveFit { FILL = 0, CONTAIN = 1, COVER = 2, FIT_WIDTH = 3, FIT_HEIGHT = 4, NONE = 5, SCALE_DOWN = 6 } export declare enum TypeRiveAlignment { TOP_LEFT = 0, TOP_CENTER = 1, TOP_RIGHT = 2, CENTER_LEFT = 3, CENTER = 4, CENTER_RIGHT = 5, BOTTOM_LEFT = 6, BOTTOM_RIGHT = 7 } export declare class RiveEvents { view: View; static onPlayEvent: string; static onPauseEvent: string; static onLoopEndEvent: string; static onStopEvent: string; static stateChangedEvent: string; static receivedInputEvent: string; static touchBeganEvent: string; static touchCancelledEvent: string; static touchEndedEvent: string; static touchMovedEvent: string; constructor(view: View); notifyEvent(name: string, data: any): void; } export declare abstract class RiveViewBase extends View { src: string; /** * Rive events */ events: RiveEvents; autoPlay: boolean; alignment?: TypeRiveAlignment; fit?: TypeRiveFit; artboard?: string; animation?: string; /** * input (optional) - Specifies which input should be used. */ input?: string; /** * inputValue (optional) - Specifies which input value should be used. */ inputValue?: boolean; stateMachine?: string; loop?: TypeRiveLoop; /** * direction. (optional). */ direction?: TypeRiveDirection; onPlay: (animation: string) => void; onPause: (animation: string) => void; onStop: (animation: string) => void; onLoopEnd: (animation: string, loopMode: TypeRiveLoop) => void; abstract play(loop?: TypeRiveLoop, direction?: TypeRiveDirection, settleInitialState?: true): void; abstract playWithAnimations(animations?: string | string[], loop?: TypeRiveLoop, direction?: TypeRiveDirection, areStateMachines?: false, settleInitialState?: true): void; /** * Stops all. */ abstract stop(): void; /** * Stops any of the provided animations. */ abstract stopWithAnimations(animations: string | string[], areStateMachines?: false): void; /** * Pauses all playing animations. */ abstract pause(): void; abstract pauseWithAnimations(animations: string | string[], areStateMachines?: false): void; /** * Reset the view by resetting the current artboard, before any animations have been applied * * Note: this will respect [autoplay] */ abstract reset(): void; abstract fireState(stateMachineName: string, inputName: string): void; abstract isPlaying(): boolean; /** * Get the currently loaded StateMachine. */ abstract getStateMachines(): any; /** * * Get the currently playing StateMachine. */ abstract getPlayingStateMachines(): any; /** * Get the currently loaded animations. */ abstract getAnimations(): any; /** * Get the currently playing animations. */ abstract getPlayingAnimations(): any; } export declare const autoPlayProperty: Property<RiveViewBase, boolean>; export declare const fitProperty: Property<RiveViewBase, TypeRiveFit>; export declare const alignmentProperty: Property<RiveViewBase, TypeRiveAlignment>; export declare const artboardProperty: Property<RiveViewBase, string>; export declare const animationProperty: Property<RiveViewBase, string>; export declare const stateMachineProperty: Property<RiveViewBase, string>; export declare const inputValueProperty: Property<RiveViewBase, string | number | boolean>; export declare const srcProperty: Property<RiveViewBase, string>;