UNPKG

modern-canvas

Version:

A JavaScript WebGL rendering engine. only the ESM.

63 lines (62 loc) 2.88 kB
import type { Node, TimelineNodeProperties } from '../main'; import { RawWeakMap } from 'modern-idoc'; import { Element2D } from '../2d'; import { TimelineNode } from '../main'; export declare const linear: (amount: number) => number; export declare const ease: (amount: number) => number; export declare const easeIn: (amount: number) => number; export declare const easeOut: (amount: number) => number; export declare const easeInOut: (amount: number) => number; export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number; export declare const timingFunctions: { linear: (amount: number) => number; ease: (amount: number) => number; easeIn: (amount: number) => number; easeOut: (amount: number) => number; easeInOut: (amount: number) => number; }; export type TimingFunctions = typeof timingFunctions; export type Easing = keyof TimingFunctions | `cubic-bezier(${string})`; export interface Keyframe { easing?: Easing; offset?: number; [property: string]: string | number | null | undefined; } export interface NormalizedKeyframe { easing: (amount: number) => number; offset: number; props: Record<string, any>; } export type AnimationEffectMode = 'parent' | 'sibling'; export interface AnimationProperties extends Omit<TimelineNodeProperties, 'renderMode' | 'processMode'> { effectMode: AnimationEffectMode; loop: boolean; keyframes: Keyframe[]; } export declare class Animation extends TimelineNode { effectMode: AnimationEffectMode; keyframes: Keyframe[]; easing: Easing | undefined; protected _keyframes: NormalizedKeyframe[]; protected _isFirstUpdatePosition: boolean; protected _cachedProps: RawWeakMap<any, Map<string, any>>; protected _stoped: boolean; constructor(properties?: Partial<AnimationProperties>, children?: Node[]); protected _parented(parent: Node): void; protected _unparented(oldParent: Node): void; protected _process(): void; protected _updateProperty(key: string, value: any, oldValue: any): void; protected _getTargets(): Element2D[]; protected _updateKeyframes(): void; commitStyles(): void; protected _updateCachedProps(): void; protected _parseEasing(easing: Easing | undefined): (amount: number) => number; protected _parseKeyframes(currentTime: number, startProps: Map<string, any>): [NormalizedKeyframe, NormalizedKeyframe] | null; protected _commitStyle(currentTime: number, target: Element2D, startProps: Map<string, any>, previous: NormalizedKeyframe, current: NormalizedKeyframe): void; protected _getDiffValue(name: string, previous: string | undefined, current: string | undefined, weight: number, context: Record<string, any>): any; isPlaying(): boolean; play(): boolean; pause(): boolean; stop(): boolean; cancel(): void; }