import { IterationCountType, DirectionType, AnimatorState, EasingFunction, FillModeType, PlayStateType, EasingType, AnimatorOptions, AnimatorEvents } from "./types"; import EventEmitter from "@scena/event-emitter"; export declare function isDirectionReverse(iteration: number, iteraiontCount: IterationCountType, direction: DirectionType): boolean; /** * @typedef {Object} AnimatorState The Animator options. Properties used in css animation. * @property {number} [duration] The duration property defines how long an animation should take to complete one cycle. * @property {"none"|"forwards"|"backwards"|"both"} [fillMode] The fillMode property specifies a style for the element when the animation is not playing (before it starts, after it ends, or both). * @property {"infinite"|number} [iterationCount] The iterationCount property specifies the number of times an animation should be played. * @property {array|function} [easing] The easing(timing-function) specifies the speed curve of an animation. * @property {number} [delay] The delay property specifies a delay for the start of an animation. * @property {"normal"|"reverse"|"alternate"|"alternate-reverse"} [direction] The direction property defines whether an animation should be played forwards, backwards or in alternate cycles. */ export declare const ANIMATOR_SETTERS: string[]; export declare const ANIMATOR_GETTERS: string[]; /** * play video, animation, the others * @extends EventEmitter * @see {@link https://www.w3schools.com/css/css3_animations.asp CSS3 Animation} */ declare class Animator extends EventEmitter { state: State; private timerId; /** * @param - animator's options * @example const animator = new Animator({ delay: 2, diretion: "alternate", duration: 2, fillMode: "forwards", iterationCount: 3, easing: Scene.easing.EASE, }); */ constructor(options?: Partial); /** * set animator's easing. * @param curverArray - The speed curve of an animation. * @return {Animator} An instance itself. * @example animator.({ delay: 2, diretion: "alternate", duration: 2, fillMode: "forwards", iterationCount: 3, easing: Scene.easing.EASE, }); */ setEasing(curveArray: string | number[] | EasingFunction): this; /** * set animator's options. * @see {@link https://www.w3schools.com/css/css3_animations.asp|CSS3 Animation} * @param - animator's options * @return {Animator} An instance itself. * @example animator.({ delay: 2, diretion: "alternate", duration: 2, fillMode: "forwards", iterationCount: 3, easing: Scene.eaasing.EASE, }); */ setOptions(options?: Partial): this; /** * Get the animator's total duration including delay * @return {number} Total duration * @example animator.getTotalDuration(); */ getTotalDuration(): number; /** * Get the animator's total duration excluding delay * @return {number} Total duration excluding delay * @example animator.getActiveDuration(); */ getActiveDuration(delay?: boolean): number; /** * Check if the animator has reached the end. * @return {boolean} ended * @example animator.isEnded(); // true or false */ isEnded(): boolean; /** *Check if the animator is paused: * @return {boolean} paused * @example animator.isPaused(); // true or false */ isPaused(): boolean; start(delay?: number): boolean; /** * play animator * @return {Animator} An instance itself. */ play(toTime?: number): this; /** * pause animator * @return {Animator} An instance itself. */ pause(): this; /** * end animator * @return {Animator} An instance itself. */ finish(): this; /** * end animator * @return {Animator} An instance itself. */ end(): this; /** * set currentTime * @param {Number|String} time - currentTime * @return {Animator} An instance itself. * @example animator.setTime("from"); // 0 animator.setTime("to"); // 100% animator.setTime("50%"); animator.setTime(10); animator.getTime() // 10 */ setTime(time: number | string, isTick?: boolean, isParent?: boolean, exec?: () => void): this; /** * Get the animator's current time * @return {number} current time * @example animator.getTime(); */ getTime(): number; getUnitTime(time: string | number): number; /** * Check if the current state of animator is delayed. * @return {boolean} check delay state */ isDelay(): boolean; setIteration(iterationCount: number): this; protected calculate(): this; private tick; } /** * Specifies the unique indicator of the animator * @method Animator#setId * @param {number | string} - String or number of id to be set in the animator * @return {Animator} An instance itself. */ /** * Specifies the unique indicator of the animator * @method Animator#getId * @return {number | string} the indicator of the item. */ /** * Get a delay for the start of an animation. * @method Animator#getDelay * @return {number} delay */ /** * Set a delay for the start of an animation. * @method Animator#setDelay * @param {number} delay - delay * @return {Animator} An instance itself. */ /** * Get fill mode for the item when the animation is not playing (before it starts, after it ends, or both) * @method Animator#getFillMode * @return {FillModeType} fillMode */ /** * Set fill mode for the item when the animation is not playing (before it starts, after it ends, or both) * @method Animator#setFillMode * @param {FillModeType} fillMode - fillMode * @return {Animator} An instance itself. */ /** * Get the number of times an animation should be played. * @method Animator#getIterationCount * @return {IterationCountType} iterationCount */ /** * Set the number of times an animation should be played. * @method Animator#setIterationCount * @param {IterationCountType} iterationCount - iterationCount * @return {Animator} An instance itself. */ /** * Get whether an animation should be played forwards, backwards or in alternate cycles. * @method Animator#getDirection * @return {DirectionType} direction */ /** * Set whether an animation should be played forwards, backwards or in alternate cycles. * @method Animator#setDirection * @param {DirectionType} direction - direction * @return {Animator} An instance itself. */ /** * Get whether the animation is running or paused. * @method Animator#getPlayState * @return {PlayStateType} playState */ /** * Set whether the animation is running or paused. * @method Animator#setPlayState * @param {PlayStateType} playState - playState * @return {Animator} An instance itself. */ /** * Get the animator's play speed * @method Animator#getPlaySpeed * @return {number} playSpeed */ /** * Set the animator's play speed * @method Animator#setPlaySpeed * @param {number} playSpeed - playSpeed * @return {Animator} An instance itself. */ /** * Get how long an animation should take to complete one cycle. * @method Animator#getDuration * @return {number} duration */ /** * Set how long an animation should take to complete one cycle. * @method Animator#setDuration * @param {number} duration - duration * @return {Animator} An instance itself. */ /** * Get the speed curve of an animation. * @method Animator#getEasing * @return {EasingType} easing */ /** * Get the speed curve's name * @method Animator#getEasingName * @return {string} the curve's name. */ /** * Get the animator's current iteration time * @method Animator#getIterationTime * @return {number} current iteration time * @example animator.getIterationTime(); */ interface Animator extends EventEmitter { setId(id: number | string): this; getId(): number | string; getIterationTime(): number; setIterationTime(time: number): this; setDelay(delay: number): this; getDelay(): number; setFillMode(fillMode: FillModeType): this; getFillMode(): FillModeType; setIterationCount(iterationCount: IterationCountType): this; getIterationCount(): IterationCountType; setDirection(direction: DirectionType): this; getDirection(): DirectionType; setPlayState(playState: PlayStateType): this; getPlayState(): PlayStateType; setPlaySpeed(playSpeed: number): this; getPlaySpeed(): number; setDuration(duration: number): this; getDuration(): number; getEasing(): EasingType; getEasingName(): string; } export default Animator;