d2js-anim-lib
Version:
Lightweight animation library with support for React, Vue, and Angular
40 lines (39 loc) • 1.14 kB
TypeScript
export declare enum AnimationType {
ROTATE = "rotate",
BOUNCE = "bounce",
DRAG = "drag"
}
export interface AnimationConfig {
duration?: number;
easing?: string;
delay?: number;
iterations?: number;
}
export interface RotateOptions extends AnimationConfig {
degrees?: number;
direction?: 'clockwise' | 'counterclockwise';
}
export interface BounceOptions extends AnimationConfig {
intensity?: number;
direction?: 'up' | 'down' | 'left' | 'right';
}
export interface DragOptions extends AnimationConfig {
bounds?: {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
axis?: 'x' | 'y' | 'both';
returnToOrigin?: boolean;
}
export declare class AnimationController {
private element;
constructor(element?: HTMLElement);
setElement(element: HTMLElement): AnimationController;
rotate(options?: RotateOptions): void;
bounce(options?: BounceOptions): void;
enableDrag(options?: DragOptions): void;
disableDrag(): void;
}
export declare function createAnimationController(element?: HTMLElement): AnimationController;