| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132 |
- interface SVGAttributes {
- accentHeight?: number | string | undefined;
- accumulate?: "none" | "sum" | undefined;
- additive?: "replace" | "sum" | undefined;
- alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
- allowReorder?: "no" | "yes" | undefined;
- alphabetic?: number | string | undefined;
- amplitude?: number | string | undefined;
- arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
- ascent?: number | string | undefined;
- attributeName?: string | undefined;
- attributeType?: string | undefined;
- autoReverse?: boolean | undefined;
- azimuth?: number | string | undefined;
- baseFrequency?: number | string | undefined;
- baselineShift?: number | string | undefined;
- baseProfile?: number | string | undefined;
- bbox?: number | string | undefined;
- begin?: number | string | undefined;
- bias?: number | string | undefined;
- by?: number | string | undefined;
- calcMode?: number | string | undefined;
- capHeight?: number | string | undefined;
- clip?: number | string | undefined;
- clipPath?: string | undefined;
- clipPathUnits?: number | string | undefined;
- clipRule?: number | string | undefined;
- colorInterpolation?: number | string | undefined;
- colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
- colorProfile?: number | string | undefined;
- colorRendering?: number | string | undefined;
- contentScriptType?: number | string | undefined;
- contentStyleType?: number | string | undefined;
- cursor?: number | string | undefined;
- cx?: number | string | undefined;
- cy?: number | string | undefined;
- d?: string | undefined;
- decelerate?: number | string | undefined;
- descent?: number | string | undefined;
- diffuseConstant?: number | string | undefined;
- direction?: number | string | undefined;
- display?: number | string | undefined;
- divisor?: number | string | undefined;
- dominantBaseline?: number | string | undefined;
- dur?: number | string | undefined;
- dx?: number | string | undefined;
- dy?: number | string | undefined;
- edgeMode?: number | string | undefined;
- elevation?: number | string | undefined;
- enableBackground?: number | string | undefined;
- end?: number | string | undefined;
- exponent?: number | string | undefined;
- externalResourcesRequired?: boolean | undefined;
- fill?: string | undefined;
- fillOpacity?: number | string | undefined;
- fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
- filter?: string | undefined;
- filterRes?: number | string | undefined;
- filterUnits?: number | string | undefined;
- floodColor?: number | string | undefined;
- floodOpacity?: number | string | undefined;
- focusable?: boolean | "auto" | undefined;
- fontFamily?: string | undefined;
- fontSize?: number | string | undefined;
- fontSizeAdjust?: number | string | undefined;
- fontStretch?: number | string | undefined;
- fontStyle?: number | string | undefined;
- fontVariant?: number | string | undefined;
- fontWeight?: number | string | undefined;
- format?: number | string | undefined;
- fr?: number | string | undefined;
- from?: number | string | undefined;
- fx?: number | string | undefined;
- fy?: number | string | undefined;
- g1?: number | string | undefined;
- g2?: number | string | undefined;
- glyphName?: number | string | undefined;
- glyphOrientationHorizontal?: number | string | undefined;
- glyphOrientationVertical?: number | string | undefined;
- glyphRef?: number | string | undefined;
- gradientTransform?: string | undefined;
- gradientUnits?: string | undefined;
- hanging?: number | string | undefined;
- horizAdvX?: number | string | undefined;
- horizOriginX?: number | string | undefined;
- href?: string | undefined;
- ideographic?: number | string | undefined;
- imageRendering?: number | string | undefined;
- in2?: number | string | undefined;
- in?: string | undefined;
- intercept?: number | string | undefined;
- k1?: number | string | undefined;
- k2?: number | string | undefined;
- k3?: number | string | undefined;
- k4?: number | string | undefined;
- k?: number | string | undefined;
- kernelMatrix?: number | string | undefined;
- kernelUnitLength?: number | string | undefined;
- kerning?: number | string | undefined;
- keyPoints?: number | string | undefined;
- keySplines?: number | string | undefined;
- keyTimes?: number | string | undefined;
- lengthAdjust?: number | string | undefined;
- letterSpacing?: number | string | undefined;
- lightingColor?: number | string | undefined;
- limitingConeAngle?: number | string | undefined;
- local?: number | string | undefined;
- markerEnd?: string | undefined;
- markerHeight?: number | string | undefined;
- markerMid?: string | undefined;
- markerStart?: string | undefined;
- markerUnits?: number | string | undefined;
- markerWidth?: number | string | undefined;
- mask?: string | undefined;
- maskContentUnits?: number | string | undefined;
- maskUnits?: number | string | undefined;
- mathematical?: number | string | undefined;
- mode?: number | string | undefined;
- numOctaves?: number | string | undefined;
- offset?: number | string | undefined;
- opacity?: number | string | undefined;
- operator?: number | string | undefined;
- order?: number | string | undefined;
- orient?: number | string | undefined;
- orientation?: number | string | undefined;
- origin?: number | string | undefined;
- overflow?: number | string | undefined;
- overlinePosition?: number | string | undefined;
- overlineThickness?: number | string | undefined;
- paintOrder?: number | string | undefined;
- panose1?: number | string | undefined;
- path?: string | undefined;
- pathLength?: number | string | undefined;
- patternContentUnits?: string | undefined;
- patternTransform?: number | string | undefined;
- patternUnits?: string | undefined;
- pointerEvents?: number | string | undefined;
- points?: string | undefined;
- pointsAtX?: number | string | undefined;
- pointsAtY?: number | string | undefined;
- pointsAtZ?: number | string | undefined;
- preserveAlpha?: boolean | undefined;
- preserveAspectRatio?: string | undefined;
- primitiveUnits?: number | string | undefined;
- r?: number | string | undefined;
- radius?: number | string | undefined;
- refX?: number | string | undefined;
- refY?: number | string | undefined;
- renderingIntent?: number | string | undefined;
- repeatCount?: number | string | undefined;
- repeatDur?: number | string | undefined;
- requiredExtensions?: number | string | undefined;
- requiredFeatures?: number | string | undefined;
- restart?: number | string | undefined;
- result?: string | undefined;
- rotate?: number | string | undefined;
- rx?: number | string | undefined;
- ry?: number | string | undefined;
- scale?: number | string | undefined;
- seed?: number | string | undefined;
- shapeRendering?: number | string | undefined;
- slope?: number | string | undefined;
- spacing?: number | string | undefined;
- specularConstant?: number | string | undefined;
- specularExponent?: number | string | undefined;
- speed?: number | string | undefined;
- spreadMethod?: string | undefined;
- startOffset?: number | string | undefined;
- stdDeviation?: number | string | undefined;
- stemh?: number | string | undefined;
- stemv?: number | string | undefined;
- stitchTiles?: number | string | undefined;
- stopColor?: string | undefined;
- stopOpacity?: number | string | undefined;
- strikethroughPosition?: number | string | undefined;
- strikethroughThickness?: number | string | undefined;
- string?: number | string | undefined;
- stroke?: string | undefined;
- strokeDasharray?: string | number | undefined;
- strokeDashoffset?: string | number | undefined;
- strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
- strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
- strokeMiterlimit?: number | string | undefined;
- strokeOpacity?: number | string | undefined;
- strokeWidth?: number | string | undefined;
- surfaceScale?: number | string | undefined;
- systemLanguage?: number | string | undefined;
- tableValues?: number | string | undefined;
- targetX?: number | string | undefined;
- targetY?: number | string | undefined;
- textAnchor?: string | undefined;
- textDecoration?: number | string | undefined;
- textLength?: number | string | undefined;
- textRendering?: number | string | undefined;
- to?: number | string | undefined;
- transform?: string | undefined;
- u1?: number | string | undefined;
- u2?: number | string | undefined;
- underlinePosition?: number | string | undefined;
- underlineThickness?: number | string | undefined;
- unicode?: number | string | undefined;
- unicodeBidi?: number | string | undefined;
- unicodeRange?: number | string | undefined;
- unitsPerEm?: number | string | undefined;
- vAlphabetic?: number | string | undefined;
- values?: string | undefined;
- vectorEffect?: number | string | undefined;
- version?: string | undefined;
- vertAdvY?: number | string | undefined;
- vertOriginX?: number | string | undefined;
- vertOriginY?: number | string | undefined;
- vHanging?: number | string | undefined;
- vIdeographic?: number | string | undefined;
- viewBox?: string | undefined;
- viewTarget?: number | string | undefined;
- visibility?: number | string | undefined;
- vMathematical?: number | string | undefined;
- widths?: number | string | undefined;
- wordSpacing?: number | string | undefined;
- writingMode?: number | string | undefined;
- x1?: number | string | undefined;
- x2?: number | string | undefined;
- x?: number | string | undefined;
- xChannelSelector?: string | undefined;
- xHeight?: number | string | undefined;
- xlinkActuate?: string | undefined;
- xlinkArcrole?: string | undefined;
- xlinkHref?: string | undefined;
- xlinkRole?: string | undefined;
- xlinkShow?: string | undefined;
- xlinkTitle?: string | undefined;
- xlinkType?: string | undefined;
- xmlBase?: string | undefined;
- xmlLang?: string | undefined;
- xmlns?: string | undefined;
- xmlnsXlink?: string | undefined;
- xmlSpace?: string | undefined;
- y1?: number | string | undefined;
- y2?: number | string | undefined;
- y?: number | string | undefined;
- yChannelSelector?: string | undefined;
- z?: number | string | undefined;
- zoomAndPan?: string | undefined;
- }
- interface ProgressTimeline {
- currentTime: null | {
- value: number;
- };
- cancel?: VoidFunction;
- }
- /**
- * Methods to control an animation.
- */
- interface AnimationPlaybackControls {
- /**
- * The current time of the animation, in seconds.
- */
- time: number;
- /**
- * The playback speed of the animation.
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
- */
- speed: number;
- /**
- * The start time of the animation, in milliseconds.
- */
- startTime: number | null;
- /**
- * The state of the animation.
- *
- * This is currently for internal use only.
- */
- state?: AnimationPlayState;
- duration: number;
- /**
- * Stops the animation at its current state, and prevents it from
- * resuming when the animation is played again.
- */
- stop: () => void;
- /**
- * Plays the animation.
- */
- play: () => void;
- /**
- * Pauses the animation.
- */
- pause: () => void;
- /**
- * Completes the animation and applies the final state.
- */
- complete: () => void;
- /**
- * Cancels the animation and applies the initial state.
- */
- cancel: () => void;
- /**
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
- *
- * This is currently for internal use only.
- */
- attachTimeline?: (timeline: ProgressTimeline, fallback?: (animation: AnimationPlaybackControls) => VoidFunction) => VoidFunction;
- /**
- * Flattens the animation's easing curve to linear.
- *
- * This is currently for internal use only, and is used by scroll() to
- * ensure an animation is being scrubbed by progress rather than eased time.
- */
- flatten: () => void;
- finished: Promise<any>;
- }
- type AnimationPlaybackControlsWithThen = AnimationPlaybackControls & {
- then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
- };
- interface AnimationState<V> {
- value: V;
- done: boolean;
- }
- interface KeyframeGenerator<V> {
- calculatedDuration: null | number;
- next: (t: number) => AnimationState<V>;
- toString: () => string;
- }
- interface DOMValueAnimationOptions<V extends string | number = number> {
- element: HTMLElement | SVGElement;
- keyframes: ValueKeyframesDefinition;
- name: string;
- pseudoElement?: string;
- allowFlatten?: boolean;
- transition: ValueAnimationTransition<V>;
- }
- interface ValueAnimationOptions<V extends string | number = number> extends ValueAnimationTransition {
- keyframes: V[];
- name?: string;
- from?: V;
- isGenerator?: boolean;
- allowFlatten?: boolean;
- }
- type GeneratorFactoryFunction = (options: ValueAnimationOptions<any>) => KeyframeGenerator<any>;
- interface GeneratorFactory extends GeneratorFactoryFunction {
- applyToOptions: (options: Transition) => Transition;
- }
- type AnimationGeneratorType = GeneratorFactory | "decay" | "spring" | "keyframes" | "tween" | "inertia";
- interface AnimationPlaybackLifecycles<V> {
- onUpdate?: (latest: V) => void;
- onPlay?: () => void;
- onComplete?: () => void;
- onRepeat?: () => void;
- onStop?: () => void;
- }
- interface ValueAnimationTransition<V = any> extends Transition, AnimationPlaybackLifecycles<V> {
- }
- type RepeatType = "loop" | "reverse" | "mirror";
- interface AnimationPlaybackOptions {
- repeat?: number;
- repeatType?: RepeatType;
- repeatDelay?: number;
- }
- interface VelocityOptions {
- velocity?: number;
- restSpeed?: number;
- restDelta?: number;
- }
- interface DurationSpringOptions {
- duration?: number;
- visualDuration?: number;
- bounce?: number;
- }
- interface SpringOptions extends DurationSpringOptions, VelocityOptions {
- stiffness?: number;
- damping?: number;
- mass?: number;
- }
- interface DecayOptions extends VelocityOptions {
- keyframes?: number[];
- power?: number;
- timeConstant?: number;
- modifyTarget?: (v: number) => number;
- }
- type EasingFunction = (v: number) => number;
- type EasingModifier = (easing: EasingFunction) => EasingFunction;
- type BezierDefinition = readonly [number, number, number, number];
- type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
- /**
- * The easing function to use. Set as one of:
- *
- * - The name of an in-built easing function.
- * - An array of four numbers to define a cubic bezier curve.
- * - An easing function, that accepts and returns a progress value between `0` and `1`.
- *
- * @public
- */
- type Easing = EasingDefinition | EasingFunction;
- interface DriverControls {
- start: () => void;
- stop: () => void;
- now: () => number;
- }
- type Driver = (update: (timestamp: number) => void) => DriverControls;
- interface InertiaOptions extends DecayOptions {
- bounceStiffness?: number;
- bounceDamping?: number;
- min?: number;
- max?: number;
- }
- interface KeyframeOptions {
- ease?: Easing | Easing[];
- times?: number[];
- }
- interface Transition extends AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions, "keyframes">, KeyframeOptions {
- delay?: number;
- elapsed?: number;
- driver?: Driver;
- type?: AnimationGeneratorType;
- duration?: number;
- autoplay?: boolean;
- startTime?: number;
- }
- type SVGPathTransitions = {
- [K in keyof SVGPathProperties]: Transition;
- };
- type SVGTransitions = {
- [K in keyof SVGAttributes]: Transition;
- };
- type VariableTransitions = {
- [key: `--${string}`]: Transition;
- };
- type StyleTransitions = {
- [K in keyof CSSStyleDeclarationWithTransform]?: Transition;
- };
- type ValueKeyframe = string | number;
- type UnresolvedValueKeyframe = ValueKeyframe | null;
- type ResolvedValueKeyframe = ValueKeyframe | ValueKeyframe[];
- type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
- type StyleKeyframesDefinition = {
- [K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
- };
- type SVGKeyframesDefinition = {
- [K in keyof SVGAttributes]?: ValueKeyframesDefinition;
- };
- type VariableKeyframesDefinition = {
- [key: `--${string}`]: ValueKeyframesDefinition;
- };
- type SVGPathKeyframesDefinition = {
- [K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
- };
- type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & VariableKeyframesDefinition;
- interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "direction" | "transition" | "x" | "y" | "z"> {
- x: number | string;
- y: number | string;
- z: number | string;
- rotateX: number | string;
- rotateY: number | string;
- rotateZ: number | string;
- scaleX: number;
- scaleY: number;
- scaleZ: number;
- skewX: number | string;
- skewY: number | string;
- }
- type AnimationOptionsWithValueOverrides<V = any> = StyleTransitions & SVGPathTransitions & SVGTransitions & VariableTransitions & ValueAnimationTransition<V>;
- type DynamicOption<T> = (i: number, total: number) => T;
- interface AnimationOptions extends Omit<AnimationOptionsWithValueOverrides, "delay"> {
- delay?: number | DynamicOption<number>;
- }
- interface TransformProperties {
- x?: string | number;
- y?: string | number;
- z?: string | number;
- translateX?: string | number;
- translateY?: string | number;
- translateZ?: string | number;
- rotate?: string | number;
- rotateX?: string | number;
- rotateY?: string | number;
- rotateZ?: string | number;
- scale?: string | number;
- scaleX?: string | number;
- scaleY?: string | number;
- scaleZ?: string | number;
- skew?: string | number;
- skewX?: string | number;
- skewY?: string | number;
- originX?: string | number;
- originY?: string | number;
- originZ?: string | number;
- perspective?: string | number;
- transformPerspective?: string | number;
- }
- interface SVGPathProperties {
- pathLength?: number;
- pathOffset?: number;
- pathSpacing?: number;
- }
- type AcceptedAnimations = AnimationPlaybackControls;
- type GroupedAnimations = AcceptedAnimations[];
- declare class GroupAnimation implements AnimationPlaybackControls {
- animations: GroupedAnimations;
- constructor(animations: Array<AcceptedAnimations | undefined>);
- get finished(): Promise<any[]>;
- /**
- * TODO: Filter out cancelled or stopped animations before returning
- */
- private getAll;
- private setAll;
- attachTimeline(timeline: any, fallback?: (animation: AnimationPlaybackControls) => VoidFunction): () => void;
- get time(): number;
- set time(time: number);
- get speed(): number;
- set speed(speed: number);
- get startTime(): any;
- get duration(): number;
- private runAll;
- flatten(): void;
- play(): void;
- pause(): void;
- stop: () => void;
- cancel(): void;
- complete(): void;
- }
- declare class GroupAnimationWithThen extends GroupAnimation implements AnimationPlaybackControlsWithThen {
- then(onResolve: VoidFunction, _onReject?: VoidFunction): Promise<void>;
- }
- interface NativeAnimationOptions<V extends string | number = number> extends DOMValueAnimationOptions<V> {
- pseudoElement?: string;
- }
- interface NativeControlsOptions {
- animation: Animation;
- }
- /**
- * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.
- */
- declare class NativeAnimation implements AnimationPlaybackControls {
- /**
- * The interfaced Web Animation API animation
- */
- private animation;
- private allowFlatten;
- private removeAnimation;
- private isPseudoElement;
- constructor(options: NativeAnimationOptions | NativeControlsOptions);
- play(): void;
- pause(): void;
- complete(): void;
- cancel(): void;
- stop(): void;
- /**
- * WAAPI doesn't natively have any interruption capabilities.
- *
- * In this method, we commit styles back to the DOM before cancelling
- * the animation.
- *
- * This is designed to be overridden by NativeAnimationExtended, which
- * will create a renderless JS animation and sample it twice to calculate
- * its current value, "previous" value, and therefore allow
- * Motion to also correctly calculate velocity for any subsequent animation
- * while deferring the commit until the next animation frame.
- */
- private commitStyles;
- get duration(): number;
- get time(): number;
- set time(newTime: number);
- /**
- * The playback speed of the animation.
- * 1 = normal speed, 2 = double speed, 0.5 = half speed.
- */
- get speed(): number;
- set speed(newSpeed: number);
- get state(): AnimationPlayState;
- get startTime(): number;
- get finished(): Promise<Animation>;
- flatten(): void;
- /**
- * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
- */
- attachTimeline(timeline: ProgressTimeline): VoidFunction;
- /**
- * Allows the animation to be awaited.
- *
- * @deprecated Use `finished` instead.
- */
- then(onResolve: VoidFunction, onReject?: VoidFunction): Promise<void>;
- }
- declare function getValueTransition(transition: any, key: string): any;
- /**
- * Implement a practical max duration for keyframe generation
- * to prevent infinite loops
- */
- declare const maxGeneratorDuration = 20000;
- declare function calcGeneratorDuration(generator: KeyframeGenerator<unknown>): number;
- /**
- * Create a progress => progress easing function from a generator.
- */
- declare function createGeneratorEasing(options: Transition, scale: number | undefined, createGenerator: GeneratorFactory): {
- type: string;
- ease: (progress: number) => number;
- duration: number;
- };
- declare function isGenerator(type?: AnimationGeneratorType): type is GeneratorFactory;
- declare const cubicBezierAsString: ([a, b, c, d]: BezierDefinition) => string;
- declare function isWaapiSupportedEasing(easing?: Easing | Easing[]): boolean;
- declare function mapEasingToNativeEasing(easing: Easing | Easing[] | undefined, duration: number): undefined | string | string[];
- declare const supportedWaapiEasing: {
- linear: string;
- ease: string;
- easeIn: string;
- easeOut: string;
- easeInOut: string;
- circIn: string;
- circOut: string;
- backIn: string;
- backOut: string;
- };
- declare function startWaapiAnimation(element: Element, valueName: string, keyframes: ValueKeyframesDefinition, { delay, duration, repeat, repeatType, ease, times, }?: Transition, pseudoElement?: string | undefined): Animation;
- declare function attachTimeline(animation: Animation, timeline: any): void;
- declare const generateLinearEasing: (easing: EasingFunction, duration: number, resolution?: number) => string;
- declare const frame: Batcher;
- declare const cancelFrame: (process: Process) => void;
- declare const frameData: FrameData;
- declare const frameSteps: Steps;
- type Process = (data: FrameData) => void;
- type Schedule = (process: Process, keepAlive?: boolean, immediate?: boolean) => Process;
- interface Step {
- schedule: Schedule;
- cancel: (process: Process) => void;
- process: (data: FrameData) => void;
- }
- type StepId = "read" | "resolveKeyframes" | "update" | "preRender" | "render" | "postRender";
- type CancelProcess = (process: Process) => void;
- type Batcher = {
- [key in StepId]: Schedule;
- };
- type Steps = {
- [key in StepId]: Step;
- };
- interface FrameData {
- delta: number;
- timestamp: number;
- isProcessing: boolean;
- }
- declare function createRenderBatcher(scheduleNextBatch: (callback: Function) => void, allowKeepAlive: boolean): {
- schedule: Batcher;
- cancel: (process: Process) => void;
- state: FrameData;
- steps: Steps;
- };
- declare const microtask: Batcher;
- declare const cancelMicrotask: (process: Process) => void;
- /**
- * An eventloop-synchronous alternative to performance.now().
- *
- * Ensures that time measurements remain consistent within a synchronous context.
- * Usually calling performance.now() twice within the same synchronous context
- * will return different values which isn't useful for animations when we're usually
- * trying to sync animations to the same frame.
- */
- declare const time: {
- now: () => number;
- set: (newTime: number) => void;
- };
- declare const isDragging: {
- x: boolean;
- y: boolean;
- };
- declare function isDragActive(): boolean;
- declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
- type ElementOrSelector = Element | Element[] | NodeListOf<Element> | string;
- interface WithQuerySelectorAll {
- querySelectorAll: Element["querySelectorAll"];
- }
- interface AnimationScope<T = any> {
- readonly current: T;
- animations: any[];
- }
- interface SelectorCache {
- [key: string]: NodeListOf<Element>;
- }
- declare function resolveElements(elementOrSelector: ElementOrSelector, scope?: AnimationScope, selectorCache?: SelectorCache): Element[];
- /**
- * Options for the hover gesture.
- *
- * @public
- */
- interface EventOptions {
- /**
- * Use passive event listeners. Doing so allows the browser to optimize
- * scrolling performance by not allowing the use of `preventDefault()`.
- *
- * @default true
- */
- passive?: boolean;
- /**
- * Remove the event listener after the first event.
- *
- * @default false
- */
- once?: boolean;
- }
- /**
- * A function to be called when a hover gesture starts.
- *
- * This function can optionally return a function that will be called
- * when the hover gesture ends.
- *
- * @public
- */
- type OnHoverStartEvent = (element: Element, event: PointerEvent) => void | OnHoverEndEvent;
- /**
- * A function to be called when a hover gesture ends.
- *
- * @public
- */
- type OnHoverEndEvent = (event: PointerEvent) => void;
- /**
- * Create a hover gesture. hover() is different to .addEventListener("pointerenter")
- * in that it has an easier syntax, filters out polyfilled touch events, interoperates
- * with drag gestures, and automatically removes the "pointerennd" event listener when the hover ends.
- *
- * @public
- */
- declare function hover(elementOrSelector: ElementOrSelector, onHoverStart: OnHoverStartEvent, options?: EventOptions): VoidFunction;
- interface PressGestureInfo {
- success: boolean;
- }
- type OnPressEndEvent = (event: PointerEvent, info: PressGestureInfo) => void;
- type OnPressStartEvent = (element: Element, event: PointerEvent) => OnPressEndEvent | void;
- interface PointerEventOptions extends EventOptions {
- useGlobalTarget?: boolean;
- }
- /**
- * Create a press gesture.
- *
- * Press is different to `"pointerdown"`, `"pointerup"` in that it
- * automatically filters out secondary pointer events like right
- * click and multitouch.
- *
- * It also adds accessibility support for keyboards, where
- * an element with a press gesture will receive focus and
- * trigger on Enter `"keydown"` and `"keyup"` events.
- *
- * This is different to a browser's `"click"` event, which does
- * respond to keyboards but only for the `"click"` itself, rather
- * than the press start and end/cancel. The element also needs
- * to be focusable for this to work, whereas a press gesture will
- * make an element focusable by default.
- *
- * @public
- */
- declare function press(targetOrSelector: ElementOrSelector, onPressStart: OnPressStartEvent, options?: PointerEventOptions): VoidFunction;
- /**
- * Recursively traverse up the tree to check whether the provided child node
- * is the parent or a descendant of it.
- *
- * @param parent - Element to find
- * @param child - Element to test against parent
- */
- declare const isNodeOrChild: (parent: Element | null, child?: Element | null) => boolean;
- declare const isPrimaryPointer: (event: PointerEvent) => boolean;
- declare const stepsOrder: StepId[];
- type StepNames = (typeof stepsOrder)[number];
- interface Summary {
- min: number;
- max: number;
- avg: number;
- }
- type FrameloopStatNames = "rate" | StepNames;
- interface Stats<T> {
- frameloop: {
- [key in FrameloopStatNames]: T;
- };
- animations: {
- mainThread: T;
- waapi: T;
- layout: T;
- };
- layoutProjection: {
- nodes: T;
- calculatedTargetDeltas: T;
- calculatedProjections: T;
- };
- }
- type StatsBuffer = number[];
- type FrameStats = Stats<number>;
- type StatsRecording = Stats<StatsBuffer>;
- type StatsSummary = Stats<Summary>;
- declare function reportStats(): StatsSummary;
- declare function recordStats(): typeof reportStats;
- declare const activeAnimations: {
- layout: number;
- mainThread: number;
- waapi: number;
- };
- type InactiveStatsBuffer = {
- value: null;
- addProjectionMetrics: null;
- };
- type ActiveStatsBuffer = {
- value: StatsRecording;
- addProjectionMetrics: (metrics: {
- nodes: number;
- calculatedTargetDeltas: number;
- calculatedProjections: number;
- }) => void;
- };
- declare const statsBuffer: InactiveStatsBuffer | ActiveStatsBuffer;
- declare const isBezierDefinition: (easing: Easing | Easing[]) => easing is BezierDefinition;
- /**
- * Add the ability for test suites to manually set support flags
- * to better test more environments.
- */
- declare const supportsFlags: Record<string, boolean | undefined>;
- declare const supportsLinearEasing: () => boolean;
- declare global {
- interface Window {
- ScrollTimeline: ScrollTimeline;
- }
- }
- declare class ScrollTimeline implements ProgressTimeline {
- constructor(options: ScrollOptions);
- currentTime: null | {
- value: number;
- };
- cancel?: VoidFunction;
- }
- declare const supportsScrollTimeline: () => boolean;
- type Transformer<T> = (v: T) => T;
- /**
- * @public
- */
- type Subscriber<T> = (v: T) => void;
- /**
- * @public
- */
- type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void;
- type StartAnimation = (complete: () => void) => AnimationPlaybackControlsWithThen | undefined;
- interface MotionValueEventCallbacks<V> {
- animationStart: () => void;
- animationComplete: () => void;
- animationCancel: () => void;
- change: (latestValue: V) => void;
- renderRequest: () => void;
- }
- interface ResolvedValues {
- [key: string]: string | number;
- }
- interface Owner {
- current: HTMLElement | unknown;
- getProps: () => {
- onUpdate?: (latest: ResolvedValues) => void;
- transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
- };
- }
- interface MotionValueOptions {
- owner?: Owner;
- }
- declare const collectMotionValues: {
- current: MotionValue[] | undefined;
- };
- /**
- * `MotionValue` is used to track the state and velocity of motion values.
- *
- * @public
- */
- declare class MotionValue<V = any> {
- /**
- * This will be replaced by the build step with the latest version number.
- * When MotionValues are provided to motion components, warn if versions are mixed.
- */
- version: string;
- /**
- * If a MotionValue has an owner, it was created internally within Motion
- * and therefore has no external listeners. It is therefore safe to animate via WAAPI.
- */
- owner?: Owner;
- /**
- * The current state of the `MotionValue`.
- */
- private current;
- /**
- * The previous state of the `MotionValue`.
- */
- private prev;
- /**
- * The previous state of the `MotionValue` at the end of the previous frame.
- */
- private prevFrameValue;
- /**
- * The last time the `MotionValue` was updated.
- */
- updatedAt: number;
- /**
- * The time `prevFrameValue` was updated.
- */
- prevUpdatedAt: number | undefined;
- private stopPassiveEffect?;
- /**
- * A reference to the currently-controlling animation.
- */
- animation?: AnimationPlaybackControlsWithThen;
- /**
- * Tracks whether this value should be removed
- */
- liveStyle?: boolean;
- /**
- * @param init - The initiating value
- * @param config - Optional configuration options
- *
- * - `transformer`: A function to transform incoming values with.
- */
- constructor(init: V, options?: MotionValueOptions);
- setCurrent(current: V): void;
- setPrevFrameValue(prevFrameValue?: V | undefined): void;
- /**
- * Adds a function that will be notified when the `MotionValue` is updated.
- *
- * It returns a function that, when called, will cancel the subscription.
- *
- * When calling `onChange` inside a React component, it should be wrapped with the
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
- *
- * ```jsx
- * export const MyComponent = () => {
- * const x = useMotionValue(0)
- * const y = useMotionValue(0)
- * const opacity = useMotionValue(1)
- *
- * useEffect(() => {
- * function updateOpacity() {
- * const maxXY = Math.max(x.get(), y.get())
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
- * opacity.set(newOpacity)
- * }
- *
- * const unsubscribeX = x.on("change", updateOpacity)
- * const unsubscribeY = y.on("change", updateOpacity)
- *
- * return () => {
- * unsubscribeX()
- * unsubscribeY()
- * }
- * }, [])
- *
- * return <motion.div style={{ x }} />
- * }
- * ```
- *
- * @param subscriber - A function that receives the latest value.
- * @returns A function that, when called, will cancel this subscription.
- *
- * @deprecated
- */
- onChange(subscription: Subscriber<V>): () => void;
- /**
- * An object containing a SubscriptionManager for each active event.
- */
- private events;
- on<EventName extends keyof MotionValueEventCallbacks<V>>(eventName: EventName, callback: MotionValueEventCallbacks<V>[EventName]): VoidFunction;
- clearListeners(): void;
- /**
- * Attaches a passive effect to the `MotionValue`.
- */
- attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction): void;
- /**
- * Sets the state of the `MotionValue`.
- *
- * @remarks
- *
- * ```jsx
- * const x = useMotionValue(0)
- * x.set(10)
- * ```
- *
- * @param latest - Latest value to set.
- * @param render - Whether to notify render subscribers. Defaults to `true`
- *
- * @public
- */
- set(v: V, render?: boolean): void;
- setWithVelocity(prev: V, current: V, delta: number): void;
- /**
- * Set the state of the `MotionValue`, stopping any active animations,
- * effects, and resets velocity to `0`.
- */
- jump(v: V, endAnimation?: boolean): void;
- updateAndNotify: (v: V, render?: boolean) => void;
- /**
- * Returns the latest state of `MotionValue`
- *
- * @returns - The latest state of `MotionValue`
- *
- * @public
- */
- get(): NonNullable<V>;
- /**
- * @public
- */
- getPrevious(): V | undefined;
- /**
- * Returns the latest velocity of `MotionValue`
- *
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
- *
- * @public
- */
- getVelocity(): number;
- hasAnimated: boolean;
- /**
- * Registers a new animation to control this `MotionValue`. Only one
- * animation can drive a `MotionValue` at one time.
- *
- * ```jsx
- * value.start()
- * ```
- *
- * @param animation - A function that starts the provided animation
- */
- start(startAnimation: StartAnimation): Promise<void>;
- /**
- * Stop the currently active animation.
- *
- * @public
- */
- stop(): void;
- /**
- * Returns `true` if this value is currently animating.
- *
- * @public
- */
- isAnimating(): boolean;
- private clearAnimation;
- /**
- * Destroy and clean up subscribers to this `MotionValue`.
- *
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
- * created a `MotionValue` via the `motionValue` function.
- *
- * @public
- */
- destroy(): void;
- }
- declare function motionValue<V>(init: V, options?: MotionValueOptions): MotionValue<V>;
- type ViewTransitionAnimationDefinition = {
- keyframes: DOMKeyframesDefinition;
- options: AnimationOptions;
- };
- type ViewTransitionTarget = {
- layout?: ViewTransitionAnimationDefinition;
- enter?: ViewTransitionAnimationDefinition;
- exit?: ViewTransitionAnimationDefinition;
- new?: ViewTransitionAnimationDefinition;
- old?: ViewTransitionAnimationDefinition;
- };
- interface ViewTransitionOptions extends AnimationOptions {
- interrupt?: "wait" | "immediate";
- }
- type Target = string | Element;
- declare class ViewTransitionBuilder {
- private currentTarget;
- targets: Map<Target, ViewTransitionTarget>;
- update: () => void | Promise<void>;
- options: ViewTransitionOptions;
- notifyReady: (value: GroupAnimation) => void;
- private readyPromise;
- constructor(update: () => void | Promise<void>, options?: ViewTransitionOptions);
- get(selector: Target): this;
- layout(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
- new(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
- old(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
- enter(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
- exit(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
- crossfade(options?: AnimationOptions): this;
- updateTarget(target: "enter" | "exit" | "layout" | "new" | "old", keyframes: DOMKeyframesDefinition, options?: AnimationOptions): void;
- then(resolve: () => void, reject?: () => void): Promise<void>;
- }
- declare function animateView(update: () => void | Promise<void>, defaultOptions?: ViewTransitionOptions): ViewTransitionBuilder;
- /**
- * @deprecated
- *
- * Import as `frame` instead.
- */
- declare const sync: Batcher;
- /**
- * @deprecated
- *
- * Use cancelFrame(callback) instead.
- */
- declare const cancelSync: Record<string, (process: Process) => void>;
- export { type AcceptedAnimations, type ActiveStatsBuffer, type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, type Batcher, type BezierDefinition, type CSSStyleDeclarationWithTransform, type CancelProcess, type DOMKeyframesDefinition, type DOMValueAnimationOptions, type DecayOptions, type Driver, type DriverControls, type DurationSpringOptions, type DynamicOption, type Easing, type EasingDefinition, type EasingFunction, type EasingModifier, type ElementOrSelector, type EventOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type InactiveStatsBuffer, type InertiaOptions, type KeyframeGenerator, type KeyframeOptions, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, NativeAnimation, type NativeAnimationOptions, type NativeControlsOptions, type OnHoverEndEvent, type OnHoverStartEvent, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PassiveEffect, type PointerEventOptions, type PressGestureInfo, type Process, type ProgressTimeline, type RepeatType, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type Schedule, type SelectorCache, type SpringOptions, type StartAnimation, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Step, type StepId, type Steps, type StyleKeyframesDefinition, type StyleTransitions, type Subscriber, type Summary, type Target, type TransformProperties, type Transformer, type Transition, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationTransition, type ValueKeyframe, type ValueKeyframesDefinition, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, activeAnimations, animateView, attachTimeline, calcGeneratorDuration, cancelFrame, cancelMicrotask, cancelSync, collectMotionValues, createGeneratorEasing, createRenderBatcher, cubicBezierAsString, frame, frameData, frameSteps, generateLinearEasing, getValueTransition, hover, isBezierDefinition, isDragActive, isDragging, isGenerator, isNodeOrChild, isPrimaryPointer, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, microtask, motionValue, press, recordStats, resolveElements, setDragLock, startWaapiAnimation, statsBuffer, supportedWaapiEasing, supportsFlags, supportsLinearEasing, supportsScrollTimeline, sync, time };
|