vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
91 lines • 3.1 kB
TypeScript
import { Module, TModuleOnCallbacksProps } from '../../base/Module';
import { TRequiredProps } from '../../internal/requiredProps';
import { ITimelineCallbacksMap, ITimelineMutableProps, ITimelineStaticProps } from './types';
export * from './types';
type TC = ITimelineCallbacksMap;
type TS = ITimelineStaticProps;
type TM = ITimelineMutableProps;
/**
* A timeline class for managing animations with easing and precise progress control.
* It provides methods for playing, reversing, pausing, and resetting the timeline.
*
* [Documentation](https://vevetjs.com/docs/Timeline)
*
* @group Components
*/
export declare class Timeline extends Module<TC, TS, TM> {
/** Get default static properties. */
_getStatic(): TRequiredProps<TS>;
/** Get default mutable properties. */
_getMutable(): TRequiredProps<TM>;
/** Current linear progress of the timeline (0 to 1). */
private _progress;
/** Current eased progress of the timeline (after applying easing function). */
private _eased;
/** Stores the ID of the current animation frame request. */
private _raf?;
/** Stores the timestamp of the last frame update. */
private _time;
/** Indicates whether the timeline is currently reversed. */
private _isReversed;
/** Indicates whether the timeline is paused. */
private _isPaused;
constructor(props?: TS & TM & TModuleOnCallbacksProps<TC, Timeline>, onCallbacks?: TModuleOnCallbacksProps<TC, Timeline>);
/**
* Get or set the linear progress of the timeline.
* Setting this triggers an update and associated callbacks.
*/
get progress(): number;
set progress(val: number);
/**
* Get the eased progress of the timeline, derived from the easing function.
*/
get eased(): number;
/**
* Whether the timeline is currently playing.
*/
get isPlaying(): boolean;
/**
* Whether the timeline is reversed (progress decreases over time).
*/
get isReversed(): boolean;
/**
* Whether the timeline is paused.
*/
get isPaused(): boolean;
/**
* Get the timeline duration, ensuring it is at least 0 ms.
*/
get duration(): number;
/**
* Play the timeline, advancing progress toward completion.
* Does nothing if the timeline is destroyed or already completed.
*/
play(): void;
/**
* Reverse the timeline, moving progress toward the start.
* Does nothing if the timeline is destroyed or already at the start.
*/
reverse(): void;
/**
* Pause the timeline, halting progress without resetting it.
*/
pause(): void;
/**
* Reset the timeline to the beginning (progress = 0).
*/
reset(): void;
/**
* Animate the timeline, updating progress based on elapsed time.
*/
private _animate;
/**
* Handle progress updates and trigger callbacks.
*/
private _onUpdate;
/**
* Destroy the timeline, stopping any active animation and cleaning up resources.
*/
protected _destroy(): void;
}
//# sourceMappingURL=index.d.ts.map