UNPKG

smooth-text-rotator

Version:

Super simple JS library for rotating text with smooth animations

33 lines (32 loc) 772 B
declare type Options = { automaticPause?: boolean; interval?: number; element: HTMLSpanElement; }; export declare class TextRotator { private readonly options; private readonly phraseElements; private index; private intervalID; private started; constructor(options: Options); start(): void; stop(): void; pause(): void; resume(): void; private setupResizeObserver; private setupIntersectionObserver; private startInterval; private stopInterval; private doAnimation; private displayPhrase; private showPhrase; private hidePhrase; private setWidth; /** * Hide all the phrases, show the first one and set the width * @private */ private resetPhrases; } export {};