@ngfly/carousel
Version:
A smooth, customizable carousel component for Angular 17+ applications
59 lines (58 loc) • 2.36 kB
TypeScript
/**
* Easing functions for animations
*/
export declare const easings: {
linear: (t: number) => number;
ease: (t: number) => number;
easeInQuad: (t: number) => number;
easeOutQuad: (t: number) => number;
easeInOutQuad: (t: number) => number;
easeInCubic: (t: number) => number;
easeOutCubic: (t: number) => number;
easeInOutCubic: (t: number) => number;
};
/**
* Converts a CSS timing function to its JavaScript equivalent
* @param timingFunction CSS timing function string
*/
export declare function getCssTimingFunction(timingFunction: string): (t: number) => number;
/**
* Creates a CSS transform string for translating elements
*
* @param position - Translation position in pixels
* @param isVertical - Whether to use vertical translation
* @returns CSS transform string
*/
export declare function createTranslation(position: number, isVertical: boolean): string;
/**
* Parse time string to milliseconds
* @param time Time string in the format: '300ms' or '0.3s'
* @param defaultValue Default value in ms
* @returns Time in milliseconds
*/
export declare function parseTimeToMs(time: string | undefined, defaultValue?: number): number;
/**
* Calculate scroll amount based on configuration
* @param scrollSize Scroll size specification
* @param containerSize Container width or height
* @param scrollSizeMap Map of predefined scroll sizes
* @param defaultPercentage Default percentage if no size specified
* @returns Scroll amount in pixels
*/
export declare function calculateScrollAmount(scrollSize: string | undefined, containerSize: number, scrollSizeMap: Record<string, number>, defaultPercentage?: number): number;
/**
* Performs a smooth scroll animation
* @param element Element to scroll
* @param to Target scroll position
* @param duration Duration in milliseconds
* @param easing Easing function
*/
export declare function smoothScroll(element: HTMLElement, to: number, duration?: number, easing?: (t: number) => number): Promise<void>;
/**
* Performs a smooth vertical scroll animation
* @param element Element to scroll
* @param to Target scroll position
* @param duration Duration in milliseconds
* @param easing Easing function
*/
export declare function smoothScrollVertical(element: HTMLElement, to: number, duration?: number, easing?: (t: number) => number): Promise<void>;