motion-dom 12.17.0 → 12.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Box, Easing, EasingFunction, BezierDefinition } from 'motion-utils';
|
|
1
|
+
import { Box, Easing, EasingFunction, BezierDefinition, Point, BoundingBox, Axis } from 'motion-utils';
|
|
2
|
+
import { RefObject } from 'react';
|
|
2
3
|
|
|
3
4
|
interface SVGAttributes {
|
|
4
5
|
accentHeight?: number | string | undefined;
|
|
@@ -364,7 +365,7 @@ interface ValueAnimationOptions<V extends string | number = number> extends Valu
|
|
|
364
365
|
element?: any;
|
|
365
366
|
name?: string;
|
|
366
367
|
motionValue?: MotionValue<V>;
|
|
367
|
-
from?:
|
|
368
|
+
from?: any;
|
|
368
369
|
isHandoff?: boolean;
|
|
369
370
|
allowFlatten?: boolean;
|
|
370
371
|
finalKeyframe?: V;
|
|
@@ -373,7 +374,8 @@ type GeneratorFactoryFunction = (options: ValueAnimationOptions<any>) => Keyfram
|
|
|
373
374
|
interface GeneratorFactory extends GeneratorFactoryFunction {
|
|
374
375
|
applyToOptions?: (options: Transition) => Transition;
|
|
375
376
|
}
|
|
376
|
-
type
|
|
377
|
+
type AnimationGeneratorName = "decay" | "spring" | "keyframes" | "tween" | "inertia";
|
|
378
|
+
type AnimationGeneratorType = GeneratorFactory | AnimationGeneratorName | false;
|
|
377
379
|
interface AnimationPlaybackLifecycles<V> {
|
|
378
380
|
onUpdate?: (latest: V) => void;
|
|
379
381
|
onPlay?: () => void;
|
|
@@ -381,84 +383,284 @@ interface AnimationPlaybackLifecycles<V> {
|
|
|
381
383
|
onRepeat?: () => void;
|
|
382
384
|
onStop?: () => void;
|
|
383
385
|
}
|
|
384
|
-
interface ValueAnimationTransition<V = any> extends
|
|
386
|
+
interface ValueAnimationTransition<V = any> extends ValueTransition, AnimationPlaybackLifecycles<V> {
|
|
385
387
|
isSync?: boolean;
|
|
386
388
|
}
|
|
387
389
|
type RepeatType = "loop" | "reverse" | "mirror";
|
|
388
390
|
interface AnimationPlaybackOptions {
|
|
391
|
+
/**
|
|
392
|
+
* The number of times to repeat the transition. Set to `Infinity` for perpetual repeating.
|
|
393
|
+
*
|
|
394
|
+
* Without setting `repeatType`, this will loop the animation.
|
|
395
|
+
*
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
389
398
|
repeat?: number;
|
|
399
|
+
/**
|
|
400
|
+
* How to repeat the animation. This can be either:
|
|
401
|
+
*
|
|
402
|
+
* "loop": Repeats the animation from the start
|
|
403
|
+
*
|
|
404
|
+
* "reverse": Alternates between forward and backwards playback
|
|
405
|
+
*
|
|
406
|
+
* "mirror": Switches `from` and `to` alternately
|
|
407
|
+
*
|
|
408
|
+
* @public
|
|
409
|
+
*/
|
|
390
410
|
repeatType?: RepeatType;
|
|
411
|
+
/**
|
|
412
|
+
* When repeating an animation, `repeatDelay` will set the
|
|
413
|
+
* duration of the time to wait, in seconds, between each repetition.
|
|
414
|
+
*
|
|
415
|
+
* @public
|
|
416
|
+
*/
|
|
391
417
|
repeatDelay?: number;
|
|
392
418
|
}
|
|
393
419
|
interface VelocityOptions {
|
|
394
420
|
velocity?: number;
|
|
421
|
+
/**
|
|
422
|
+
* End animation if absolute speed (in units per second) drops below this
|
|
423
|
+
* value and delta is smaller than `restDelta`. Set to `0.01` by default.
|
|
424
|
+
*
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
395
427
|
restSpeed?: number;
|
|
428
|
+
/**
|
|
429
|
+
* End animation if distance is below this value and speed is below
|
|
430
|
+
* `restSpeed`. When animation ends, spring gets "snapped" to. Set to
|
|
431
|
+
* `0.01` by default.
|
|
432
|
+
*
|
|
433
|
+
* @public
|
|
434
|
+
*/
|
|
396
435
|
restDelta?: number;
|
|
397
436
|
}
|
|
398
437
|
interface DurationSpringOptions {
|
|
438
|
+
/**
|
|
439
|
+
* The total duration of the animation. Set to `0.3` by default.
|
|
440
|
+
*
|
|
441
|
+
* @public
|
|
442
|
+
*/
|
|
399
443
|
duration?: number;
|
|
444
|
+
/**
|
|
445
|
+
* If visualDuration is set, this will override duration.
|
|
446
|
+
*
|
|
447
|
+
* The visual duration is a time, set in seconds, that the animation will take to visually appear to reach its target.
|
|
448
|
+
*
|
|
449
|
+
* In other words, the bulk of the transition will occur before this time, and the "bouncy bit" will mostly happen after.
|
|
450
|
+
*
|
|
451
|
+
* This makes it easier to edit a spring, as well as visually coordinate it with other time-based animations.
|
|
452
|
+
*
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
400
455
|
visualDuration?: number;
|
|
456
|
+
/**
|
|
457
|
+
* `bounce` determines the "bounciness" of a spring animation.
|
|
458
|
+
*
|
|
459
|
+
* `0` is no bounce, and `1` is extremely bouncy.
|
|
460
|
+
*
|
|
461
|
+
* If `duration` is set, this defaults to `0.25`.
|
|
462
|
+
*
|
|
463
|
+
* Note: `bounce` and `duration` will be overridden if `stiffness`, `damping` or `mass` are set.
|
|
464
|
+
*
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
401
467
|
bounce?: number;
|
|
402
468
|
}
|
|
403
469
|
interface SpringOptions extends DurationSpringOptions, VelocityOptions {
|
|
470
|
+
/**
|
|
471
|
+
* Stiffness of the spring. Higher values will create more sudden movement.
|
|
472
|
+
* Set to `100` by default.
|
|
473
|
+
*
|
|
474
|
+
* @public
|
|
475
|
+
*/
|
|
404
476
|
stiffness?: number;
|
|
477
|
+
/**
|
|
478
|
+
* Strength of opposing force. If set to 0, spring will oscillate
|
|
479
|
+
* indefinitely. Set to `10` by default.
|
|
480
|
+
*
|
|
481
|
+
* @public
|
|
482
|
+
*/
|
|
405
483
|
damping?: number;
|
|
484
|
+
/**
|
|
485
|
+
* Mass of the moving object. Higher values will result in more lethargic
|
|
486
|
+
* movement. Set to `1` by default.
|
|
487
|
+
*
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
406
490
|
mass?: number;
|
|
407
491
|
}
|
|
408
492
|
interface DecayOptions extends VelocityOptions {
|
|
409
493
|
keyframes?: number[];
|
|
494
|
+
/**
|
|
495
|
+
* A higher power value equals a further target. Set to `0.8` by default.
|
|
496
|
+
*
|
|
497
|
+
* @public
|
|
498
|
+
*/
|
|
410
499
|
power?: number;
|
|
500
|
+
/**
|
|
501
|
+
* Adjusting the time constant will change the duration of the
|
|
502
|
+
* deceleration, thereby affecting its feel. Set to `700` by default.
|
|
503
|
+
*
|
|
504
|
+
* @public
|
|
505
|
+
*/
|
|
411
506
|
timeConstant?: number;
|
|
507
|
+
/**
|
|
508
|
+
* A function that receives the automatically-calculated target and returns a new one. Useful for snapping the target to a grid.
|
|
509
|
+
*
|
|
510
|
+
* @public
|
|
511
|
+
*/
|
|
412
512
|
modifyTarget?: (v: number) => number;
|
|
413
513
|
}
|
|
414
514
|
interface InertiaOptions extends DecayOptions {
|
|
515
|
+
/**
|
|
516
|
+
* If `min` or `max` is set, this affects the stiffness of the bounce
|
|
517
|
+
* spring. Higher values will create more sudden movement. Set to `500` by
|
|
518
|
+
* default.
|
|
519
|
+
*
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
415
522
|
bounceStiffness?: number;
|
|
523
|
+
/**
|
|
524
|
+
* If `min` or `max` is set, this affects the damping of the bounce spring.
|
|
525
|
+
* If set to `0`, spring will oscillate indefinitely. Set to `10` by
|
|
526
|
+
* default.
|
|
527
|
+
*
|
|
528
|
+
* @public
|
|
529
|
+
*/
|
|
416
530
|
bounceDamping?: number;
|
|
531
|
+
/**
|
|
532
|
+
* Minimum constraint. If set, the value will "bump" against this value (or immediately spring to it if the animation starts as less than this value).
|
|
533
|
+
*
|
|
534
|
+
* @public
|
|
535
|
+
*/
|
|
417
536
|
min?: number;
|
|
537
|
+
/**
|
|
538
|
+
* Maximum constraint. If set, the value will "bump" against this value (or immediately snap to it, if the initial animation value exceeds this value).
|
|
539
|
+
*
|
|
540
|
+
* @public
|
|
541
|
+
*/
|
|
418
542
|
max?: number;
|
|
419
543
|
}
|
|
544
|
+
interface AnimationOrchestrationOptions {
|
|
545
|
+
/**
|
|
546
|
+
* Delay the animation by this duration (in seconds). Defaults to `0`.
|
|
547
|
+
*
|
|
548
|
+
* @public
|
|
549
|
+
*/
|
|
550
|
+
delay?: number;
|
|
551
|
+
/**
|
|
552
|
+
* Describes the relationship between the transition and its children. Set
|
|
553
|
+
* to `false` by default.
|
|
554
|
+
*
|
|
555
|
+
* @remarks
|
|
556
|
+
* When using variants, the transition can be scheduled in relation to its
|
|
557
|
+
* children with either `"beforeChildren"` to finish this transition before
|
|
558
|
+
* starting children transitions, `"afterChildren"` to finish children
|
|
559
|
+
* transitions before starting this transition.
|
|
560
|
+
*
|
|
561
|
+
* @public
|
|
562
|
+
*/
|
|
563
|
+
when?: false | "beforeChildren" | "afterChildren" | string;
|
|
564
|
+
/**
|
|
565
|
+
* When using variants, children animations will start after this duration
|
|
566
|
+
* (in seconds). You can add the `transition` property to both the `Frame` and the `variant` directly. Adding it to the `variant` generally offers more flexibility, as it allows you to customize the delay per visual state.
|
|
567
|
+
*
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
delayChildren?: number;
|
|
571
|
+
/**
|
|
572
|
+
* When using variants, animations of child components can be staggered by this
|
|
573
|
+
* duration (in seconds).
|
|
574
|
+
*
|
|
575
|
+
* For instance, if `staggerChildren` is `0.01`, the first child will be
|
|
576
|
+
* delayed by `0` seconds, the second by `0.01`, the third by `0.02` and so
|
|
577
|
+
* on.
|
|
578
|
+
*
|
|
579
|
+
* The calculated stagger delay will be added to `delayChildren`.
|
|
580
|
+
*
|
|
581
|
+
* @public
|
|
582
|
+
*/
|
|
583
|
+
staggerChildren?: number;
|
|
584
|
+
/**
|
|
585
|
+
* The direction in which to stagger children.
|
|
586
|
+
*
|
|
587
|
+
* A value of `1` staggers from the first to the last while `-1`
|
|
588
|
+
* staggers from the last to the first.
|
|
589
|
+
*
|
|
590
|
+
* @public
|
|
591
|
+
*/
|
|
592
|
+
staggerDirection?: number;
|
|
593
|
+
}
|
|
420
594
|
interface KeyframeOptions {
|
|
421
595
|
ease?: Easing | Easing[];
|
|
422
596
|
times?: number[];
|
|
423
597
|
}
|
|
424
|
-
interface
|
|
598
|
+
interface ValueTransition extends AnimationOrchestrationOptions, AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions, "keyframes">, KeyframeOptions {
|
|
599
|
+
/**
|
|
600
|
+
* Delay the animation by this duration (in seconds). Defaults to `0`.
|
|
601
|
+
*
|
|
602
|
+
* @public
|
|
603
|
+
*/
|
|
425
604
|
delay?: number;
|
|
605
|
+
/**
|
|
606
|
+
* The duration of time already elapsed in the animation. Set to `0` by
|
|
607
|
+
* default.
|
|
608
|
+
*/
|
|
426
609
|
elapsed?: number;
|
|
427
610
|
driver?: Driver;
|
|
611
|
+
/**
|
|
612
|
+
* Type of animation to use.
|
|
613
|
+
*
|
|
614
|
+
* - "tween": Duration-based animation with ease curve
|
|
615
|
+
* - "spring": Physics or duration-based spring animation
|
|
616
|
+
* - false: Use an instant animation
|
|
617
|
+
*/
|
|
428
618
|
type?: AnimationGeneratorType;
|
|
619
|
+
/**
|
|
620
|
+
* The duration of the tween animation. Set to `0.3` by default, 0r `0.8` if animating a series of keyframes.
|
|
621
|
+
*
|
|
622
|
+
* @public
|
|
623
|
+
*/
|
|
429
624
|
duration?: number;
|
|
430
625
|
autoplay?: boolean;
|
|
431
626
|
startTime?: number;
|
|
627
|
+
from?: any;
|
|
432
628
|
}
|
|
629
|
+
type SVGForcedAttrTransitions = {
|
|
630
|
+
[K in keyof SVGForcedAttrProperties]: ValueTransition;
|
|
631
|
+
};
|
|
433
632
|
type SVGPathTransitions = {
|
|
434
|
-
[K in keyof SVGPathProperties]:
|
|
633
|
+
[K in keyof SVGPathProperties]: ValueTransition;
|
|
435
634
|
};
|
|
436
635
|
type SVGTransitions = {
|
|
437
|
-
[K in keyof SVGAttributes]:
|
|
636
|
+
[K in keyof Omit<SVGAttributes, "from">]: ValueTransition;
|
|
438
637
|
};
|
|
439
638
|
type VariableTransitions = {
|
|
440
|
-
[key: `--${string}`]:
|
|
639
|
+
[key: `--${string}`]: ValueTransition;
|
|
441
640
|
};
|
|
442
641
|
type StyleTransitions = {
|
|
443
|
-
[K in keyof CSSStyleDeclarationWithTransform]?:
|
|
642
|
+
[K in keyof CSSStyleDeclarationWithTransform]?: ValueTransition;
|
|
444
643
|
};
|
|
445
|
-
type ValueKeyframe = string | number;
|
|
446
|
-
type UnresolvedValueKeyframe = ValueKeyframe | null;
|
|
644
|
+
type ValueKeyframe<T extends string | number = string | number> = T;
|
|
645
|
+
type UnresolvedValueKeyframe<T extends string | number = string | number> = ValueKeyframe<T> | null;
|
|
447
646
|
type ResolvedValueKeyframe = ValueKeyframe | ValueKeyframe[];
|
|
448
647
|
type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
|
|
449
648
|
type StyleKeyframesDefinition = {
|
|
450
649
|
[K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
|
|
451
650
|
};
|
|
452
651
|
type SVGKeyframesDefinition = {
|
|
453
|
-
[K in keyof SVGAttributes]?: ValueKeyframesDefinition;
|
|
652
|
+
[K in keyof Omit<SVGAttributes, "from">]?: ValueKeyframesDefinition;
|
|
454
653
|
};
|
|
455
654
|
type VariableKeyframesDefinition = {
|
|
456
655
|
[key: `--${string}`]: ValueKeyframesDefinition;
|
|
457
656
|
};
|
|
657
|
+
type SVGForcedAttrKeyframesDefinition = {
|
|
658
|
+
[K in keyof SVGForcedAttrProperties]?: ValueKeyframesDefinition;
|
|
659
|
+
};
|
|
458
660
|
type SVGPathKeyframesDefinition = {
|
|
459
661
|
[K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
|
|
460
662
|
};
|
|
461
|
-
type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & VariableKeyframesDefinition;
|
|
663
|
+
type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & SVGForcedAttrKeyframesDefinition & VariableKeyframesDefinition;
|
|
462
664
|
interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "direction" | "transition" | "x" | "y" | "z"> {
|
|
463
665
|
x: number | string;
|
|
464
666
|
y: number | string;
|
|
@@ -472,9 +674,12 @@ interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "di
|
|
|
472
674
|
skewX: number | string;
|
|
473
675
|
skewY: number | string;
|
|
474
676
|
}
|
|
475
|
-
type
|
|
677
|
+
type Transition<V = any> = StyleTransitions & SVGPathTransitions & SVGForcedAttrTransitions & SVGTransitions & VariableTransitions & ValueAnimationTransition<V> & {
|
|
678
|
+
default?: ValueTransition;
|
|
679
|
+
layout?: ValueTransition;
|
|
680
|
+
};
|
|
476
681
|
type DynamicOption<T> = (i: number, total: number) => T;
|
|
477
|
-
interface AnimationOptions extends Omit<
|
|
682
|
+
interface AnimationOptions extends Omit<Transition, "delay"> {
|
|
478
683
|
delay?: number | DynamicOption<number>;
|
|
479
684
|
}
|
|
480
685
|
interface TransformProperties {
|
|
@@ -501,6 +706,11 @@ interface TransformProperties {
|
|
|
501
706
|
perspective?: string | number;
|
|
502
707
|
transformPerspective?: string | number;
|
|
503
708
|
}
|
|
709
|
+
interface SVGForcedAttrProperties {
|
|
710
|
+
attrX?: number;
|
|
711
|
+
attrY?: number;
|
|
712
|
+
attrScale?: number;
|
|
713
|
+
}
|
|
504
714
|
interface SVGPathProperties {
|
|
505
715
|
pathLength?: number;
|
|
506
716
|
pathOffset?: number;
|
|
@@ -524,13 +734,13 @@ interface MotionValueEventCallbacks<V> {
|
|
|
524
734
|
renderRequest: () => void;
|
|
525
735
|
destroy: () => void;
|
|
526
736
|
}
|
|
527
|
-
interface ResolvedValues {
|
|
737
|
+
interface ResolvedValues$1 {
|
|
528
738
|
[key: string]: string | number;
|
|
529
739
|
}
|
|
530
740
|
interface Owner {
|
|
531
741
|
current: HTMLElement | unknown;
|
|
532
742
|
getProps: () => {
|
|
533
|
-
onUpdate?: (latest: ResolvedValues) => void;
|
|
743
|
+
onUpdate?: (latest: ResolvedValues$1) => void;
|
|
534
744
|
transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
|
|
535
745
|
};
|
|
536
746
|
}
|
|
@@ -1061,7 +1271,7 @@ declare const supportedWaapiEasing: {
|
|
|
1061
1271
|
backOut: string;
|
|
1062
1272
|
};
|
|
1063
1273
|
|
|
1064
|
-
declare function startWaapiAnimation(element: Element, valueName: string, keyframes: ValueKeyframesDefinition, { delay, duration, repeat, repeatType, ease, times, }?:
|
|
1274
|
+
declare function startWaapiAnimation(element: Element, valueName: string, keyframes: ValueKeyframesDefinition, { delay, duration, repeat, repeatType, ease, times, }?: ValueTransition, pseudoElement?: string | undefined): Animation;
|
|
1065
1275
|
|
|
1066
1276
|
declare const supportsPartialKeyframes: () => boolean;
|
|
1067
1277
|
|
|
@@ -1153,6 +1363,93 @@ declare function isDragActive(): boolean;
|
|
|
1153
1363
|
|
|
1154
1364
|
declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
|
|
1155
1365
|
|
|
1366
|
+
/**
|
|
1367
|
+
* Passed in to pan event handlers like `onPan` the `PanInfo` object contains
|
|
1368
|
+
* information about the current state of the tap gesture such as its
|
|
1369
|
+
* `point`, `delta`, `offset` and `velocity`.
|
|
1370
|
+
*
|
|
1371
|
+
* ```jsx
|
|
1372
|
+
* <motion.div onPan={(event, info) => {
|
|
1373
|
+
* console.log(info.point.x, info.point.y)
|
|
1374
|
+
* }} />
|
|
1375
|
+
* ```
|
|
1376
|
+
*
|
|
1377
|
+
* @public
|
|
1378
|
+
*/
|
|
1379
|
+
interface PanInfo {
|
|
1380
|
+
/**
|
|
1381
|
+
* Contains `x` and `y` values for the current pan position relative
|
|
1382
|
+
* to the device or page.
|
|
1383
|
+
*
|
|
1384
|
+
* ```jsx
|
|
1385
|
+
* function onPan(event, info) {
|
|
1386
|
+
* console.log(info.point.x, info.point.y)
|
|
1387
|
+
* }
|
|
1388
|
+
*
|
|
1389
|
+
* <motion.div onPan={onPan} />
|
|
1390
|
+
* ```
|
|
1391
|
+
*
|
|
1392
|
+
* @public
|
|
1393
|
+
*/
|
|
1394
|
+
point: Point;
|
|
1395
|
+
/**
|
|
1396
|
+
* Contains `x` and `y` values for the distance moved since
|
|
1397
|
+
* the last event.
|
|
1398
|
+
*
|
|
1399
|
+
* ```jsx
|
|
1400
|
+
* function onPan(event, info) {
|
|
1401
|
+
* console.log(info.delta.x, info.delta.y)
|
|
1402
|
+
* }
|
|
1403
|
+
*
|
|
1404
|
+
* <motion.div onPan={onPan} />
|
|
1405
|
+
* ```
|
|
1406
|
+
*
|
|
1407
|
+
* @public
|
|
1408
|
+
*/
|
|
1409
|
+
delta: Point;
|
|
1410
|
+
/**
|
|
1411
|
+
* Contains `x` and `y` values for the distance moved from
|
|
1412
|
+
* the first pan event.
|
|
1413
|
+
*
|
|
1414
|
+
* ```jsx
|
|
1415
|
+
* function onPan(event, info) {
|
|
1416
|
+
* console.log(info.offset.x, info.offset.y)
|
|
1417
|
+
* }
|
|
1418
|
+
*
|
|
1419
|
+
* <motion.div onPan={onPan} />
|
|
1420
|
+
* ```
|
|
1421
|
+
*
|
|
1422
|
+
* @public
|
|
1423
|
+
*/
|
|
1424
|
+
offset: Point;
|
|
1425
|
+
/**
|
|
1426
|
+
* Contains `x` and `y` values for the current velocity of the pointer, in px/ms.
|
|
1427
|
+
*
|
|
1428
|
+
* ```jsx
|
|
1429
|
+
* function onPan(event, info) {
|
|
1430
|
+
* console.log(info.velocity.x, info.velocity.y)
|
|
1431
|
+
* }
|
|
1432
|
+
*
|
|
1433
|
+
* <motion.div onPan={onPan} />
|
|
1434
|
+
* ```
|
|
1435
|
+
*
|
|
1436
|
+
* @public
|
|
1437
|
+
*/
|
|
1438
|
+
velocity: Point;
|
|
1439
|
+
}
|
|
1440
|
+
type PanHandler = (event: Event, info: PanInfo) => void;
|
|
1441
|
+
|
|
1442
|
+
type DragHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
|
|
1443
|
+
type DragElastic = boolean | number | Partial<BoundingBox>;
|
|
1444
|
+
interface ResolvedConstraints {
|
|
1445
|
+
x: Partial<Axis>;
|
|
1446
|
+
y: Partial<Axis>;
|
|
1447
|
+
}
|
|
1448
|
+
interface ResolvedElastic {
|
|
1449
|
+
x: Axis;
|
|
1450
|
+
y: Axis;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1156
1453
|
type ElementOrSelector = Element | Element[] | NodeListOf<Element> | string;
|
|
1157
1454
|
interface WithQuerySelectorAll {
|
|
1158
1455
|
querySelectorAll: Element["querySelectorAll"];
|
|
@@ -1252,6 +1549,925 @@ declare const isNodeOrChild: (parent: Element | null, child?: Element | null) =>
|
|
|
1252
1549
|
|
|
1253
1550
|
declare const isPrimaryPointer: (event: PointerEvent) => boolean;
|
|
1254
1551
|
|
|
1552
|
+
interface EventInfo {
|
|
1553
|
+
point: Point;
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* A generic set of string/number values
|
|
1557
|
+
*/
|
|
1558
|
+
interface ResolvedValues {
|
|
1559
|
+
[key: string]: string | number;
|
|
1560
|
+
}
|
|
1561
|
+
type AnimationDefinition = VariantLabels | TargetAndTransition | TargetResolver;
|
|
1562
|
+
/**
|
|
1563
|
+
* An object that specifies values to animate to. Each value may be set either as
|
|
1564
|
+
* a single value, or an array of values.
|
|
1565
|
+
*
|
|
1566
|
+
* It may also option contain these properties:
|
|
1567
|
+
*
|
|
1568
|
+
* - `transition`: Specifies transitions for all or individual values.
|
|
1569
|
+
* - `transitionEnd`: Specifies values to set when the animation finishes.
|
|
1570
|
+
*
|
|
1571
|
+
* ```jsx
|
|
1572
|
+
* const target = {
|
|
1573
|
+
* x: "0%",
|
|
1574
|
+
* opacity: 0,
|
|
1575
|
+
* transition: { duration: 1 },
|
|
1576
|
+
* transitionEnd: { display: "none" }
|
|
1577
|
+
* }
|
|
1578
|
+
* ```
|
|
1579
|
+
*
|
|
1580
|
+
* @public
|
|
1581
|
+
*/
|
|
1582
|
+
type TargetAndTransition = DOMKeyframesDefinition & {
|
|
1583
|
+
transition?: Transition;
|
|
1584
|
+
transitionEnd?: ResolvedValues;
|
|
1585
|
+
};
|
|
1586
|
+
type TargetResolver = (custom: any, current: ResolvedValues, velocity: ResolvedValues) => TargetAndTransition | string;
|
|
1587
|
+
/**
|
|
1588
|
+
* Either a string, or array of strings, that reference variants defined via the `variants` prop.
|
|
1589
|
+
* @public
|
|
1590
|
+
*/
|
|
1591
|
+
type VariantLabels = string | string[];
|
|
1592
|
+
type Variant = TargetAndTransition | TargetResolver;
|
|
1593
|
+
interface Variants {
|
|
1594
|
+
[key: string]: Variant;
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* @deprecated
|
|
1598
|
+
*/
|
|
1599
|
+
type LegacyAnimationControls = {
|
|
1600
|
+
/**
|
|
1601
|
+
* Subscribes a component's animation controls to this.
|
|
1602
|
+
*
|
|
1603
|
+
* @param controls - The controls to subscribe
|
|
1604
|
+
* @returns An unsubscribe function.
|
|
1605
|
+
*/
|
|
1606
|
+
subscribe(visualElement: any): () => void;
|
|
1607
|
+
/**
|
|
1608
|
+
* Starts an animation on all linked components.
|
|
1609
|
+
*
|
|
1610
|
+
* @remarks
|
|
1611
|
+
*
|
|
1612
|
+
* ```jsx
|
|
1613
|
+
* controls.start("variantLabel")
|
|
1614
|
+
* controls.start({
|
|
1615
|
+
* x: 0,
|
|
1616
|
+
* transition: { duration: 1 }
|
|
1617
|
+
* })
|
|
1618
|
+
* ```
|
|
1619
|
+
*
|
|
1620
|
+
* @param definition - Properties or variant label to animate to
|
|
1621
|
+
* @param transition - Optional `transition` to apply to a variant
|
|
1622
|
+
* @returns - A `Promise` that resolves when all animations have completed.
|
|
1623
|
+
*
|
|
1624
|
+
* @public
|
|
1625
|
+
*/
|
|
1626
|
+
start(definition: AnimationDefinition, transitionOverride?: Transition): Promise<any>;
|
|
1627
|
+
/**
|
|
1628
|
+
* Instantly set to a set of properties or a variant.
|
|
1629
|
+
*
|
|
1630
|
+
* ```jsx
|
|
1631
|
+
* // With properties
|
|
1632
|
+
* controls.set({ opacity: 0 })
|
|
1633
|
+
*
|
|
1634
|
+
* // With variants
|
|
1635
|
+
* controls.set("hidden")
|
|
1636
|
+
* ```
|
|
1637
|
+
*
|
|
1638
|
+
* @privateRemarks
|
|
1639
|
+
* We could perform a similar trick to `.start` where this can be called before mount
|
|
1640
|
+
* and we maintain a list of of pending actions that get applied on mount. But the
|
|
1641
|
+
* expectation of `set` is that it happens synchronously and this would be difficult
|
|
1642
|
+
* to do before any children have even attached themselves. It's also poor practise
|
|
1643
|
+
* and we should discourage render-synchronous `.start` calls rather than lean into this.
|
|
1644
|
+
*
|
|
1645
|
+
* @public
|
|
1646
|
+
*/
|
|
1647
|
+
set(definition: AnimationDefinition): void;
|
|
1648
|
+
/**
|
|
1649
|
+
* Stops animations on all linked components.
|
|
1650
|
+
*
|
|
1651
|
+
* ```jsx
|
|
1652
|
+
* controls.stop()
|
|
1653
|
+
* ```
|
|
1654
|
+
*
|
|
1655
|
+
* @public
|
|
1656
|
+
*/
|
|
1657
|
+
stop(): void;
|
|
1658
|
+
mount(): () => void;
|
|
1659
|
+
};
|
|
1660
|
+
interface MotionNodeAnimationOptions {
|
|
1661
|
+
/**
|
|
1662
|
+
* Properties, variant label or array of variant labels to start in.
|
|
1663
|
+
*
|
|
1664
|
+
* Set to `false` to initialise with the values in `animate` (disabling the mount animation)
|
|
1665
|
+
*
|
|
1666
|
+
* ```jsx
|
|
1667
|
+
* // As values
|
|
1668
|
+
* <motion.div initial={{ opacity: 1 }} />
|
|
1669
|
+
*
|
|
1670
|
+
* // As variant
|
|
1671
|
+
* <motion.div initial="visible" variants={variants} />
|
|
1672
|
+
*
|
|
1673
|
+
* // Multiple variants
|
|
1674
|
+
* <motion.div initial={["visible", "active"]} variants={variants} />
|
|
1675
|
+
*
|
|
1676
|
+
* // As false (disable mount animation)
|
|
1677
|
+
* <motion.div initial={false} animate={{ opacity: 0 }} />
|
|
1678
|
+
* ```
|
|
1679
|
+
*/
|
|
1680
|
+
initial?: TargetAndTransition | VariantLabels | boolean;
|
|
1681
|
+
/**
|
|
1682
|
+
* Values to animate to, variant label(s), or `LegacyAnimationControls`.
|
|
1683
|
+
*
|
|
1684
|
+
* ```jsx
|
|
1685
|
+
* // As values
|
|
1686
|
+
* <motion.div animate={{ opacity: 1 }} />
|
|
1687
|
+
*
|
|
1688
|
+
* // As variant
|
|
1689
|
+
* <motion.div animate="visible" variants={variants} />
|
|
1690
|
+
*
|
|
1691
|
+
* // Multiple variants
|
|
1692
|
+
* <motion.div animate={["visible", "active"]} variants={variants} />
|
|
1693
|
+
*
|
|
1694
|
+
* // LegacyAnimationControls
|
|
1695
|
+
* <motion.div animate={animation} />
|
|
1696
|
+
* ```
|
|
1697
|
+
*/
|
|
1698
|
+
animate?: TargetAndTransition | VariantLabels | boolean | LegacyAnimationControls;
|
|
1699
|
+
/**
|
|
1700
|
+
* A target to animate to when this component is removed from the tree.
|
|
1701
|
+
*
|
|
1702
|
+
* This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation.
|
|
1703
|
+
*
|
|
1704
|
+
* This limitation exists because React doesn't allow components to defer unmounting until after
|
|
1705
|
+
* an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary.
|
|
1706
|
+
*
|
|
1707
|
+
* ```jsx
|
|
1708
|
+
* import { AnimatePresence, motion } from 'framer-motion'
|
|
1709
|
+
*
|
|
1710
|
+
* export const MyComponent = ({ isVisible }) => {
|
|
1711
|
+
* return (
|
|
1712
|
+
* <AnimatePresence>
|
|
1713
|
+
* {isVisible && (
|
|
1714
|
+
* <motion.div
|
|
1715
|
+
* initial={{ opacity: 0 }}
|
|
1716
|
+
* animate={{ opacity: 1 }}
|
|
1717
|
+
* exit={{ opacity: 0 }}
|
|
1718
|
+
* />
|
|
1719
|
+
* )}
|
|
1720
|
+
* </AnimatePresence>
|
|
1721
|
+
* )
|
|
1722
|
+
* }
|
|
1723
|
+
* ```
|
|
1724
|
+
*/
|
|
1725
|
+
exit?: TargetAndTransition | VariantLabels;
|
|
1726
|
+
/**
|
|
1727
|
+
* Variants allow you to define animation states and organise them by name. They allow
|
|
1728
|
+
* you to control animations throughout a component tree by switching a single `animate` prop.
|
|
1729
|
+
*
|
|
1730
|
+
* Using `transition` options like `delayChildren` and `staggerChildren`, you can orchestrate
|
|
1731
|
+
* when children animations play relative to their parent.
|
|
1732
|
+
|
|
1733
|
+
*
|
|
1734
|
+
* After passing variants to one or more `motion` component's `variants` prop, these variants
|
|
1735
|
+
* can be used in place of values on the `animate`, `initial`, `whileFocus`, `whileTap` and `whileHover` props.
|
|
1736
|
+
*
|
|
1737
|
+
* ```jsx
|
|
1738
|
+
* const variants = {
|
|
1739
|
+
* active: {
|
|
1740
|
+
* backgroundColor: "#f00"
|
|
1741
|
+
* },
|
|
1742
|
+
* inactive: {
|
|
1743
|
+
* backgroundColor: "#fff",
|
|
1744
|
+
* transition: { duration: 2 }
|
|
1745
|
+
* }
|
|
1746
|
+
* }
|
|
1747
|
+
*
|
|
1748
|
+
* <motion.div variants={variants} animate="active" />
|
|
1749
|
+
* ```
|
|
1750
|
+
*/
|
|
1751
|
+
variants?: Variants;
|
|
1752
|
+
/**
|
|
1753
|
+
* Default transition. If no `transition` is defined in `animate`, it will use the transition defined here.
|
|
1754
|
+
* ```jsx
|
|
1755
|
+
* const spring = {
|
|
1756
|
+
* type: "spring",
|
|
1757
|
+
* damping: 10,
|
|
1758
|
+
* stiffness: 100
|
|
1759
|
+
* }
|
|
1760
|
+
*
|
|
1761
|
+
* <motion.div transition={spring} animate={{ scale: 1.2 }} />
|
|
1762
|
+
* ```
|
|
1763
|
+
*/
|
|
1764
|
+
transition?: Transition;
|
|
1765
|
+
}
|
|
1766
|
+
interface MotionNodeEventOptions {
|
|
1767
|
+
/**
|
|
1768
|
+
* Callback with latest motion values, fired max once per frame.
|
|
1769
|
+
*
|
|
1770
|
+
* ```jsx
|
|
1771
|
+
* function onUpdate(latest) {
|
|
1772
|
+
* console.log(latest.x, latest.opacity)
|
|
1773
|
+
* }
|
|
1774
|
+
*
|
|
1775
|
+
* <motion.div animate={{ x: 100, opacity: 0 }} onUpdate={onUpdate} />
|
|
1776
|
+
* ```
|
|
1777
|
+
*/
|
|
1778
|
+
onUpdate?(latest: ResolvedValues): void;
|
|
1779
|
+
/**
|
|
1780
|
+
* Callback when animation defined in `animate` begins.
|
|
1781
|
+
*
|
|
1782
|
+
* The provided callback will be called with the triggering animation definition.
|
|
1783
|
+
* If this is a variant, it'll be the variant name, and if a target object
|
|
1784
|
+
* then it'll be the target object.
|
|
1785
|
+
*
|
|
1786
|
+
* This way, it's possible to figure out which animation has started.
|
|
1787
|
+
*
|
|
1788
|
+
* ```jsx
|
|
1789
|
+
* function onStart() {
|
|
1790
|
+
* console.log("Animation started")
|
|
1791
|
+
* }
|
|
1792
|
+
*
|
|
1793
|
+
* <motion.div animate={{ x: 100 }} onAnimationStart={onStart} />
|
|
1794
|
+
* ```
|
|
1795
|
+
*/
|
|
1796
|
+
onAnimationStart?(definition: AnimationDefinition): void;
|
|
1797
|
+
/**
|
|
1798
|
+
* Callback when animation defined in `animate` is complete.
|
|
1799
|
+
*
|
|
1800
|
+
* The provided callback will be called with the triggering animation definition.
|
|
1801
|
+
* If this is a variant, it'll be the variant name, and if a target object
|
|
1802
|
+
* then it'll be the target object.
|
|
1803
|
+
*
|
|
1804
|
+
* This way, it's possible to figure out which animation has completed.
|
|
1805
|
+
*
|
|
1806
|
+
* ```jsx
|
|
1807
|
+
* function onComplete() {
|
|
1808
|
+
* console.log("Animation completed")
|
|
1809
|
+
* }
|
|
1810
|
+
*
|
|
1811
|
+
* <motion.div
|
|
1812
|
+
* animate={{ x: 100 }}
|
|
1813
|
+
* onAnimationComplete={definition => {
|
|
1814
|
+
* console.log('Completed animating', definition)
|
|
1815
|
+
* }}
|
|
1816
|
+
* />
|
|
1817
|
+
* ```
|
|
1818
|
+
*/
|
|
1819
|
+
onAnimationComplete?(definition: AnimationDefinition): void;
|
|
1820
|
+
onBeforeLayoutMeasure?(box: Box): void;
|
|
1821
|
+
onLayoutMeasure?(box: Box, prevBox: Box): void;
|
|
1822
|
+
onLayoutAnimationStart?(): void;
|
|
1823
|
+
onLayoutAnimationComplete?(): void;
|
|
1824
|
+
}
|
|
1825
|
+
interface MotionNodePanHandlers {
|
|
1826
|
+
/**
|
|
1827
|
+
* Callback function that fires when the pan gesture is recognised on this element.
|
|
1828
|
+
*
|
|
1829
|
+
* **Note:** For pan gestures to work correctly with touch input, the element needs
|
|
1830
|
+
* touch scrolling to be disabled on either x/y or both axis with the
|
|
1831
|
+
* [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) CSS rule.
|
|
1832
|
+
*
|
|
1833
|
+
* ```jsx
|
|
1834
|
+
* function onPan(event, info) {
|
|
1835
|
+
* console.log(info.point.x, info.point.y)
|
|
1836
|
+
* }
|
|
1837
|
+
*
|
|
1838
|
+
* <motion.div onPan={onPan} />
|
|
1839
|
+
* ```
|
|
1840
|
+
*
|
|
1841
|
+
* @param event - The originating pointer event.
|
|
1842
|
+
* @param info - A {@link PanInfo} object containing `x` and `y` values for:
|
|
1843
|
+
*
|
|
1844
|
+
* - `point`: Relative to the device or page.
|
|
1845
|
+
* - `delta`: Distance moved since the last event.
|
|
1846
|
+
* - `offset`: Offset from the original pan event.
|
|
1847
|
+
* - `velocity`: Current velocity of the pointer.
|
|
1848
|
+
*/
|
|
1849
|
+
onPan?(event: PointerEvent, info: PanInfo): void;
|
|
1850
|
+
/**
|
|
1851
|
+
* Callback function that fires when the pan gesture begins on this element.
|
|
1852
|
+
*
|
|
1853
|
+
* ```jsx
|
|
1854
|
+
* function onPanStart(event, info) {
|
|
1855
|
+
* console.log(info.point.x, info.point.y)
|
|
1856
|
+
* }
|
|
1857
|
+
*
|
|
1858
|
+
* <motion.div onPanStart={onPanStart} />
|
|
1859
|
+
* ```
|
|
1860
|
+
*
|
|
1861
|
+
* @param event - The originating pointer event.
|
|
1862
|
+
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
1863
|
+
*
|
|
1864
|
+
* - `point`: Relative to the device or page.
|
|
1865
|
+
* - `delta`: Distance moved since the last event.
|
|
1866
|
+
* - `offset`: Offset from the original pan event.
|
|
1867
|
+
* - `velocity`: Current velocity of the pointer.
|
|
1868
|
+
*/
|
|
1869
|
+
onPanStart?(event: PointerEvent, info: PanInfo): void;
|
|
1870
|
+
/**
|
|
1871
|
+
* Callback function that fires when we begin detecting a pan gesture. This
|
|
1872
|
+
* is analogous to `onMouseStart` or `onTouchStart`.
|
|
1873
|
+
*
|
|
1874
|
+
* ```jsx
|
|
1875
|
+
* function onPanSessionStart(event, info) {
|
|
1876
|
+
* console.log(info.point.x, info.point.y)
|
|
1877
|
+
* }
|
|
1878
|
+
*
|
|
1879
|
+
* <motion.div onPanSessionStart={onPanSessionStart} />
|
|
1880
|
+
* ```
|
|
1881
|
+
*
|
|
1882
|
+
* @param event - The originating pointer event.
|
|
1883
|
+
* @param info - An {@link EventInfo} object containing `x`/`y` values for:
|
|
1884
|
+
*
|
|
1885
|
+
* - `point`: Relative to the device or page.
|
|
1886
|
+
*/
|
|
1887
|
+
onPanSessionStart?(event: PointerEvent, info: EventInfo): void;
|
|
1888
|
+
/**
|
|
1889
|
+
* Callback function that fires when the pan gesture ends on this element.
|
|
1890
|
+
*
|
|
1891
|
+
* ```jsx
|
|
1892
|
+
* function onPanEnd(event, info) {
|
|
1893
|
+
* console.log(info.point.x, info.point.y)
|
|
1894
|
+
* }
|
|
1895
|
+
*
|
|
1896
|
+
* <motion.div onPanEnd={onPanEnd} />
|
|
1897
|
+
* ```
|
|
1898
|
+
*
|
|
1899
|
+
* @param event - The originating pointer event.
|
|
1900
|
+
* @param info - A {@link PanInfo} object containing `x`/`y` values for:
|
|
1901
|
+
*
|
|
1902
|
+
* - `point`: Relative to the device or page.
|
|
1903
|
+
* - `delta`: Distance moved since the last event.
|
|
1904
|
+
* - `offset`: Offset from the original pan event.
|
|
1905
|
+
* - `velocity`: Current velocity of the pointer.
|
|
1906
|
+
*/
|
|
1907
|
+
onPanEnd?(event: PointerEvent, info: PanInfo): void;
|
|
1908
|
+
}
|
|
1909
|
+
interface MotionNodeHoverHandlers {
|
|
1910
|
+
/**
|
|
1911
|
+
* Properties or variant label to animate to while the hover gesture is recognised.
|
|
1912
|
+
*
|
|
1913
|
+
* ```jsx
|
|
1914
|
+
* <motion.div whileHover={{ scale: 1.2 }} />
|
|
1915
|
+
* ```
|
|
1916
|
+
*/
|
|
1917
|
+
whileHover?: VariantLabels | TargetAndTransition;
|
|
1918
|
+
/**
|
|
1919
|
+
* Callback function that fires when pointer starts hovering over the component.
|
|
1920
|
+
*
|
|
1921
|
+
* ```jsx
|
|
1922
|
+
* <motion.div onHoverStart={() => console.log('Hover starts')} />
|
|
1923
|
+
* ```
|
|
1924
|
+
*/
|
|
1925
|
+
onHoverStart?(event: MouseEvent, info: EventInfo): void;
|
|
1926
|
+
/**
|
|
1927
|
+
* Callback function that fires when pointer stops hovering over the component.
|
|
1928
|
+
*
|
|
1929
|
+
* ```jsx
|
|
1930
|
+
* <motion.div onHoverEnd={() => console.log("Hover ends")} />
|
|
1931
|
+
* ```
|
|
1932
|
+
*/
|
|
1933
|
+
onHoverEnd?(event: MouseEvent, info: EventInfo): void;
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Passed in to tap event handlers like `onTap` the `TapInfo` object contains
|
|
1937
|
+
* information about the tap gesture such as it‘s location.
|
|
1938
|
+
*
|
|
1939
|
+
* ```jsx
|
|
1940
|
+
* function onTap(event, info) {
|
|
1941
|
+
* console.log(info.point.x, info.point.y)
|
|
1942
|
+
* }
|
|
1943
|
+
*
|
|
1944
|
+
* <motion.div onTap={onTap} />
|
|
1945
|
+
* ```
|
|
1946
|
+
*
|
|
1947
|
+
* @public
|
|
1948
|
+
*/
|
|
1949
|
+
interface TapInfo {
|
|
1950
|
+
/**
|
|
1951
|
+
* Contains `x` and `y` values for the tap gesture relative to the
|
|
1952
|
+
* device or page.
|
|
1953
|
+
*
|
|
1954
|
+
* ```jsx
|
|
1955
|
+
* function onTapStart(event, info) {
|
|
1956
|
+
* console.log(info.point.x, info.point.y)
|
|
1957
|
+
* }
|
|
1958
|
+
*
|
|
1959
|
+
* <motion.div onTapStart={onTapStart} />
|
|
1960
|
+
* ```
|
|
1961
|
+
*
|
|
1962
|
+
* @public
|
|
1963
|
+
*/
|
|
1964
|
+
point: Point;
|
|
1965
|
+
}
|
|
1966
|
+
interface MotionNodeTapHandlers {
|
|
1967
|
+
/**
|
|
1968
|
+
* Callback when the tap gesture successfully ends on this element.
|
|
1969
|
+
*
|
|
1970
|
+
* ```jsx
|
|
1971
|
+
* function onTap(event, info) {
|
|
1972
|
+
* console.log(info.point.x, info.point.y)
|
|
1973
|
+
* }
|
|
1974
|
+
*
|
|
1975
|
+
* <motion.div onTap={onTap} />
|
|
1976
|
+
* ```
|
|
1977
|
+
*
|
|
1978
|
+
* @param event - The originating pointer event.
|
|
1979
|
+
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
1980
|
+
*/
|
|
1981
|
+
onTap?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
1982
|
+
/**
|
|
1983
|
+
* Callback when the tap gesture starts on this element.
|
|
1984
|
+
*
|
|
1985
|
+
* ```jsx
|
|
1986
|
+
* function onTapStart(event, info) {
|
|
1987
|
+
* console.log(info.point.x, info.point.y)
|
|
1988
|
+
* }
|
|
1989
|
+
*
|
|
1990
|
+
* <motion.div onTapStart={onTapStart} />
|
|
1991
|
+
* ```
|
|
1992
|
+
*
|
|
1993
|
+
* @param event - The originating pointer event.
|
|
1994
|
+
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
1995
|
+
*/
|
|
1996
|
+
onTapStart?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
1997
|
+
/**
|
|
1998
|
+
* Callback when the tap gesture ends outside this element.
|
|
1999
|
+
*
|
|
2000
|
+
* ```jsx
|
|
2001
|
+
* function onTapCancel(event, info) {
|
|
2002
|
+
* console.log(info.point.x, info.point.y)
|
|
2003
|
+
* }
|
|
2004
|
+
*
|
|
2005
|
+
* <motion.div onTapCancel={onTapCancel} />
|
|
2006
|
+
* ```
|
|
2007
|
+
*
|
|
2008
|
+
* @param event - The originating pointer event.
|
|
2009
|
+
* @param info - An {@link TapInfo} object containing `x` and `y` values for the `point` relative to the device or page.
|
|
2010
|
+
*/
|
|
2011
|
+
onTapCancel?(event: MouseEvent | TouchEvent | PointerEvent, info: TapInfo): void;
|
|
2012
|
+
/**
|
|
2013
|
+
* Properties or variant label to animate to while the component is pressed.
|
|
2014
|
+
*
|
|
2015
|
+
* ```jsx
|
|
2016
|
+
* <motion.div whileTap={{ scale: 0.8 }} />
|
|
2017
|
+
* ```
|
|
2018
|
+
*/
|
|
2019
|
+
whileTap?: VariantLabels | TargetAndTransition;
|
|
2020
|
+
/**
|
|
2021
|
+
* If `true`, the tap gesture will attach its start listener to window.
|
|
2022
|
+
*
|
|
2023
|
+
* Note: This is not supported publically.
|
|
2024
|
+
*/
|
|
2025
|
+
globalTapTarget?: boolean;
|
|
2026
|
+
}
|
|
2027
|
+
interface MotionNodeFocusHandlers {
|
|
2028
|
+
/**
|
|
2029
|
+
* Properties or variant label to animate to while the focus gesture is recognised.
|
|
2030
|
+
*
|
|
2031
|
+
* ```jsx
|
|
2032
|
+
* <motion.input whileFocus={{ scale: 1.2 }} />
|
|
2033
|
+
* ```
|
|
2034
|
+
*/
|
|
2035
|
+
whileFocus?: VariantLabels | TargetAndTransition;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* TODO: Replace with types from inView()
|
|
2039
|
+
*/
|
|
2040
|
+
type ViewportEventHandler = (entry: IntersectionObserverEntry | null) => void;
|
|
2041
|
+
interface ViewportOptions {
|
|
2042
|
+
root?: RefObject<Element | null>;
|
|
2043
|
+
once?: boolean;
|
|
2044
|
+
margin?: string;
|
|
2045
|
+
amount?: "some" | "all" | number;
|
|
2046
|
+
}
|
|
2047
|
+
interface MotionNodeViewportOptions {
|
|
2048
|
+
whileInView?: VariantLabels | TargetAndTransition;
|
|
2049
|
+
onViewportEnter?: ViewportEventHandler;
|
|
2050
|
+
onViewportLeave?: ViewportEventHandler;
|
|
2051
|
+
viewport?: ViewportOptions;
|
|
2052
|
+
}
|
|
2053
|
+
interface MotionNodeDraggableOptions {
|
|
2054
|
+
/**
|
|
2055
|
+
* Enable dragging for this element. Set to `false` by default.
|
|
2056
|
+
* Set `true` to drag in both directions.
|
|
2057
|
+
* Set `"x"` or `"y"` to only drag in a specific direction.
|
|
2058
|
+
*
|
|
2059
|
+
* ```jsx
|
|
2060
|
+
* <motion.div drag="x" />
|
|
2061
|
+
* ```
|
|
2062
|
+
*/
|
|
2063
|
+
drag?: boolean | "x" | "y";
|
|
2064
|
+
/**
|
|
2065
|
+
* Properties or variant label to animate to while the drag gesture is recognised.
|
|
2066
|
+
*
|
|
2067
|
+
* ```jsx
|
|
2068
|
+
* <motion.div whileDrag={{ scale: 1.2 }} />
|
|
2069
|
+
* ```
|
|
2070
|
+
*/
|
|
2071
|
+
whileDrag?: VariantLabels | TargetAndTransition;
|
|
2072
|
+
/**
|
|
2073
|
+
* If `true`, this will lock dragging to the initially-detected direction. Defaults to `false`.
|
|
2074
|
+
*
|
|
2075
|
+
* ```jsx
|
|
2076
|
+
* <motion.div drag dragDirectionLock />
|
|
2077
|
+
* ```
|
|
2078
|
+
*/
|
|
2079
|
+
dragDirectionLock?: boolean;
|
|
2080
|
+
/**
|
|
2081
|
+
* Allows drag gesture propagation to child components. Set to `false` by
|
|
2082
|
+
* default.
|
|
2083
|
+
*
|
|
2084
|
+
* ```jsx
|
|
2085
|
+
* <motion.div drag="x" dragPropagation />
|
|
2086
|
+
* ```
|
|
2087
|
+
*/
|
|
2088
|
+
dragPropagation?: boolean;
|
|
2089
|
+
/**
|
|
2090
|
+
* Applies constraints on the permitted draggable area.
|
|
2091
|
+
*
|
|
2092
|
+
* It can accept an object of optional `top`, `left`, `right`, and `bottom` values, measured in pixels.
|
|
2093
|
+
* This will define a distance from the named edge of the draggable component.
|
|
2094
|
+
*
|
|
2095
|
+
* Alternatively, it can accept a `ref` to another component created with React's `useRef` hook.
|
|
2096
|
+
* This `ref` should be passed both to the draggable component's `dragConstraints` prop, and the `ref`
|
|
2097
|
+
* of the component you want to use as constraints.
|
|
2098
|
+
*
|
|
2099
|
+
* ```jsx
|
|
2100
|
+
* // In pixels
|
|
2101
|
+
* <motion.div
|
|
2102
|
+
* drag="x"
|
|
2103
|
+
* dragConstraints={{ left: 0, right: 300 }}
|
|
2104
|
+
* />
|
|
2105
|
+
*
|
|
2106
|
+
* // As a ref to another component
|
|
2107
|
+
* const MyComponent = () => {
|
|
2108
|
+
* const constraintsRef = useRef(null)
|
|
2109
|
+
*
|
|
2110
|
+
* return (
|
|
2111
|
+
* <motion.div ref={constraintsRef}>
|
|
2112
|
+
* <motion.div drag dragConstraints={constraintsRef} />
|
|
2113
|
+
* </motion.div>
|
|
2114
|
+
* )
|
|
2115
|
+
* }
|
|
2116
|
+
* ```
|
|
2117
|
+
*/
|
|
2118
|
+
dragConstraints?: false | Partial<BoundingBox> | RefObject<Element | null>;
|
|
2119
|
+
/**
|
|
2120
|
+
* The degree of movement allowed outside constraints. 0 = no movement, 1 =
|
|
2121
|
+
* full movement.
|
|
2122
|
+
*
|
|
2123
|
+
* Set to `0.5` by default. Can also be set as `false` to disable movement.
|
|
2124
|
+
*
|
|
2125
|
+
* By passing an object of `top`/`right`/`bottom`/`left`, individual values can be set
|
|
2126
|
+
* per constraint. Any missing values will be set to `0`.
|
|
2127
|
+
*
|
|
2128
|
+
* ```jsx
|
|
2129
|
+
* <motion.div
|
|
2130
|
+
* drag
|
|
2131
|
+
* dragConstraints={{ left: 0, right: 300 }}
|
|
2132
|
+
* dragElastic={0.2}
|
|
2133
|
+
* />
|
|
2134
|
+
* ```
|
|
2135
|
+
*/
|
|
2136
|
+
dragElastic?: DragElastic;
|
|
2137
|
+
/**
|
|
2138
|
+
* Apply momentum from the pan gesture to the component when dragging
|
|
2139
|
+
* finishes. Set to `true` by default.
|
|
2140
|
+
*
|
|
2141
|
+
* ```jsx
|
|
2142
|
+
* <motion.div
|
|
2143
|
+
* drag
|
|
2144
|
+
* dragConstraints={{ left: 0, right: 300 }}
|
|
2145
|
+
* dragMomentum={false}
|
|
2146
|
+
* />
|
|
2147
|
+
* ```
|
|
2148
|
+
*/
|
|
2149
|
+
dragMomentum?: boolean;
|
|
2150
|
+
/**
|
|
2151
|
+
* Allows you to change dragging inertia parameters.
|
|
2152
|
+
* When releasing a draggable Frame, an animation with type `inertia` starts. The animation is based on your dragging velocity. This property allows you to customize it.
|
|
2153
|
+
* See {@link https://motion.dev/docs/react-motion-component#dragtransition | Inertia} for all properties you can use.
|
|
2154
|
+
*
|
|
2155
|
+
* ```jsx
|
|
2156
|
+
* <motion.div
|
|
2157
|
+
* drag
|
|
2158
|
+
* dragTransition={{ bounceStiffness: 600, bounceDamping: 10 }}
|
|
2159
|
+
* />
|
|
2160
|
+
* ```
|
|
2161
|
+
*/
|
|
2162
|
+
dragTransition?: InertiaOptions;
|
|
2163
|
+
/**
|
|
2164
|
+
* Usually, dragging is initiated by pressing down on a component and moving it. For some
|
|
2165
|
+
* use-cases, for instance clicking at an arbitrary point on a video scrubber, we
|
|
2166
|
+
* might want to initiate dragging from a different component than the draggable one.
|
|
2167
|
+
*
|
|
2168
|
+
* By creating a `dragControls` using the `useDragControls` hook, we can pass this into
|
|
2169
|
+
* the draggable component's `dragControls` prop. It exposes a `start` method
|
|
2170
|
+
* that can start dragging from pointer events on other components.
|
|
2171
|
+
*
|
|
2172
|
+
* ```jsx
|
|
2173
|
+
* const dragControls = useDragControls()
|
|
2174
|
+
*
|
|
2175
|
+
* function startDrag(event) {
|
|
2176
|
+
* dragControls.start(event, { snapToCursor: true })
|
|
2177
|
+
* }
|
|
2178
|
+
*
|
|
2179
|
+
* return (
|
|
2180
|
+
* <>
|
|
2181
|
+
* <div onPointerDown={startDrag} />
|
|
2182
|
+
* <motion.div drag="x" dragControls={dragControls} />
|
|
2183
|
+
* </>
|
|
2184
|
+
* )
|
|
2185
|
+
* ```
|
|
2186
|
+
*/
|
|
2187
|
+
dragControls?: any;
|
|
2188
|
+
/**
|
|
2189
|
+
* If true, element will snap back to its origin when dragging ends.
|
|
2190
|
+
*
|
|
2191
|
+
* Enabling this is the equivalent of setting all `dragConstraints` axes to `0`
|
|
2192
|
+
* with `dragElastic={1}`, but when used together `dragConstraints` can define
|
|
2193
|
+
* a wider draggable area and `dragSnapToOrigin` will ensure the element
|
|
2194
|
+
* animates back to its origin on release.
|
|
2195
|
+
*/
|
|
2196
|
+
dragSnapToOrigin?: boolean;
|
|
2197
|
+
/**
|
|
2198
|
+
* By default, if `drag` is defined on a component then an event listener will be attached
|
|
2199
|
+
* to automatically initiate dragging when a user presses down on it.
|
|
2200
|
+
*
|
|
2201
|
+
* By setting `dragListener` to `false`, this event listener will not be created.
|
|
2202
|
+
*
|
|
2203
|
+
* ```jsx
|
|
2204
|
+
* const dragControls = useDragControls()
|
|
2205
|
+
*
|
|
2206
|
+
* function startDrag(event) {
|
|
2207
|
+
* dragControls.start(event, { snapToCursor: true })
|
|
2208
|
+
* }
|
|
2209
|
+
*
|
|
2210
|
+
* return (
|
|
2211
|
+
* <>
|
|
2212
|
+
* <div onPointerDown={startDrag} />
|
|
2213
|
+
* <motion.div
|
|
2214
|
+
* drag="x"
|
|
2215
|
+
* dragControls={dragControls}
|
|
2216
|
+
* dragListener={false}
|
|
2217
|
+
* />
|
|
2218
|
+
* </>
|
|
2219
|
+
* )
|
|
2220
|
+
* ```
|
|
2221
|
+
*/
|
|
2222
|
+
dragListener?: boolean;
|
|
2223
|
+
/**
|
|
2224
|
+
* If `dragConstraints` is set to a React ref, this callback will call with the measured drag constraints.
|
|
2225
|
+
*
|
|
2226
|
+
* @public
|
|
2227
|
+
*/
|
|
2228
|
+
onMeasureDragConstraints?: (constraints: BoundingBox) => BoundingBox | void;
|
|
2229
|
+
/**
|
|
2230
|
+
* Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
|
|
2231
|
+
* Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
|
|
2232
|
+
* This allows you to manually control how updates from a drag gesture on an element is applied.
|
|
2233
|
+
*
|
|
2234
|
+
* @public
|
|
2235
|
+
*/
|
|
2236
|
+
_dragX?: MotionValue<number>;
|
|
2237
|
+
/**
|
|
2238
|
+
* Usually, dragging uses the layout project engine, and applies transforms to the underlying VisualElement.
|
|
2239
|
+
* Passing MotionValues as _dragX and _dragY instead applies drag updates to these motion values.
|
|
2240
|
+
* This allows you to manually control how updates from a drag gesture on an element is applied.
|
|
2241
|
+
*
|
|
2242
|
+
* @public
|
|
2243
|
+
*/
|
|
2244
|
+
_dragY?: MotionValue<number>;
|
|
2245
|
+
}
|
|
2246
|
+
interface MotionNodeDragHandlers {
|
|
2247
|
+
/**
|
|
2248
|
+
* Callback function that fires when dragging starts.
|
|
2249
|
+
*
|
|
2250
|
+
* ```jsx
|
|
2251
|
+
* <motion.div
|
|
2252
|
+
* drag
|
|
2253
|
+
* onDragStart={
|
|
2254
|
+
* (event, info) => console.log(info.point.x, info.point.y)
|
|
2255
|
+
* }
|
|
2256
|
+
* />
|
|
2257
|
+
* ```
|
|
2258
|
+
*
|
|
2259
|
+
* @public
|
|
2260
|
+
*/
|
|
2261
|
+
onDragStart?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
2262
|
+
/**
|
|
2263
|
+
* Callback function that fires when dragging ends.
|
|
2264
|
+
*
|
|
2265
|
+
* ```jsx
|
|
2266
|
+
* <motion.div
|
|
2267
|
+
* drag
|
|
2268
|
+
* onDragEnd={
|
|
2269
|
+
* (event, info) => console.log(info.point.x, info.point.y)
|
|
2270
|
+
* }
|
|
2271
|
+
* />
|
|
2272
|
+
* ```
|
|
2273
|
+
*
|
|
2274
|
+
* @public
|
|
2275
|
+
*/
|
|
2276
|
+
onDragEnd?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
2277
|
+
/**
|
|
2278
|
+
* Callback function that fires when the component is dragged.
|
|
2279
|
+
*
|
|
2280
|
+
* ```jsx
|
|
2281
|
+
* <motion.div
|
|
2282
|
+
* drag
|
|
2283
|
+
* onDrag={
|
|
2284
|
+
* (event, info) => console.log(info.point.x, info.point.y)
|
|
2285
|
+
* }
|
|
2286
|
+
* />
|
|
2287
|
+
* ```
|
|
2288
|
+
*
|
|
2289
|
+
* @public
|
|
2290
|
+
*/
|
|
2291
|
+
onDrag?(event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void;
|
|
2292
|
+
/**
|
|
2293
|
+
* Callback function that fires a drag direction is determined.
|
|
2294
|
+
*
|
|
2295
|
+
* ```jsx
|
|
2296
|
+
* <motion.div
|
|
2297
|
+
* drag
|
|
2298
|
+
* dragDirectionLock
|
|
2299
|
+
* onDirectionLock={axis => console.log(axis)}
|
|
2300
|
+
* />
|
|
2301
|
+
* ```
|
|
2302
|
+
*
|
|
2303
|
+
* @public
|
|
2304
|
+
*/
|
|
2305
|
+
onDirectionLock?(axis: "x" | "y"): void;
|
|
2306
|
+
/**
|
|
2307
|
+
* Callback function that fires when drag momentum/bounce transition finishes.
|
|
2308
|
+
*
|
|
2309
|
+
* ```jsx
|
|
2310
|
+
* <motion.div
|
|
2311
|
+
* drag
|
|
2312
|
+
* onDragTransitionEnd={() => console.log('Drag transition complete')}
|
|
2313
|
+
* />
|
|
2314
|
+
* ```
|
|
2315
|
+
*
|
|
2316
|
+
* @public
|
|
2317
|
+
*/
|
|
2318
|
+
onDragTransitionEnd?(): void;
|
|
2319
|
+
}
|
|
2320
|
+
interface MotionNodeLayoutOptions {
|
|
2321
|
+
/**
|
|
2322
|
+
* If `true`, this component will automatically animate to its new position when
|
|
2323
|
+
* its layout changes.
|
|
2324
|
+
*
|
|
2325
|
+
* ```jsx
|
|
2326
|
+
* <motion.div layout />
|
|
2327
|
+
* ```
|
|
2328
|
+
*
|
|
2329
|
+
* This will perform a layout animation using performant transforms. Part of this technique
|
|
2330
|
+
* involved animating an element's scale. This can introduce visual distortions on children,
|
|
2331
|
+
* `boxShadow` and `borderRadius`.
|
|
2332
|
+
*
|
|
2333
|
+
* To correct distortion on immediate children, add `layout` to those too.
|
|
2334
|
+
*
|
|
2335
|
+
* `boxShadow` and `borderRadius` will automatically be corrected if they are already being
|
|
2336
|
+
* animated on this component. Otherwise, set them directly via the `initial` prop.
|
|
2337
|
+
*
|
|
2338
|
+
* If `layout` is set to `"position"`, the size of the component will change instantly and
|
|
2339
|
+
* only its position will animate.
|
|
2340
|
+
*
|
|
2341
|
+
* If `layout` is set to `"size"`, the position of the component will change instantly and
|
|
2342
|
+
* only its size will animate.
|
|
2343
|
+
*
|
|
2344
|
+
* If `layout` is set to `"preserve-aspect"`, the component will animate size & position if
|
|
2345
|
+
* the aspect ratio remains the same between renders, and just position if the ratio changes.
|
|
2346
|
+
*
|
|
2347
|
+
* @public
|
|
2348
|
+
*/
|
|
2349
|
+
layout?: boolean | "position" | "size" | "preserve-aspect";
|
|
2350
|
+
/**
|
|
2351
|
+
* Enable shared layout transitions between different components with the same `layoutId`.
|
|
2352
|
+
*
|
|
2353
|
+
* When a component with a layoutId is removed from the React tree, and then
|
|
2354
|
+
* added elsewhere, it will visually animate from the previous component's bounding box
|
|
2355
|
+
* and its latest animated values.
|
|
2356
|
+
*
|
|
2357
|
+
* ```jsx
|
|
2358
|
+
* {items.map(item => (
|
|
2359
|
+
* <motion.li layout>
|
|
2360
|
+
* {item.name}
|
|
2361
|
+
* {item.isSelected && <motion.div layoutId="underline" />}
|
|
2362
|
+
* </motion.li>
|
|
2363
|
+
* ))}
|
|
2364
|
+
* ```
|
|
2365
|
+
*
|
|
2366
|
+
* If the previous component remains in the tree it will crossfade with the new component.
|
|
2367
|
+
*
|
|
2368
|
+
* @public
|
|
2369
|
+
*/
|
|
2370
|
+
layoutId?: string;
|
|
2371
|
+
/**
|
|
2372
|
+
* A callback that will fire when a layout animation on this component starts.
|
|
2373
|
+
*
|
|
2374
|
+
* @public
|
|
2375
|
+
*/
|
|
2376
|
+
onLayoutAnimationStart?(): void;
|
|
2377
|
+
/**
|
|
2378
|
+
* A callback that will fire when a layout animation on this component completes.
|
|
2379
|
+
*
|
|
2380
|
+
* @public
|
|
2381
|
+
*/
|
|
2382
|
+
onLayoutAnimationComplete?(): void;
|
|
2383
|
+
/**
|
|
2384
|
+
* @public
|
|
2385
|
+
*/
|
|
2386
|
+
layoutDependency?: any;
|
|
2387
|
+
/**
|
|
2388
|
+
* Whether a projection node should measure its scroll when it or its descendants update their layout.
|
|
2389
|
+
*
|
|
2390
|
+
* @public
|
|
2391
|
+
*/
|
|
2392
|
+
layoutScroll?: boolean;
|
|
2393
|
+
/**
|
|
2394
|
+
* Whether an element should be considered a "layout root", where
|
|
2395
|
+
* all children will be forced to resolve relatively to it.
|
|
2396
|
+
* Currently used for `position: sticky` elements in Framer.
|
|
2397
|
+
*/
|
|
2398
|
+
layoutRoot?: boolean;
|
|
2399
|
+
/**
|
|
2400
|
+
* Attached to a portal root to ensure we attach the child to the document root and don't
|
|
2401
|
+
* perform scale correction on it.
|
|
2402
|
+
*/
|
|
2403
|
+
"data-framer-portal-id"?: string;
|
|
2404
|
+
/**
|
|
2405
|
+
* By default, shared layout elements will crossfade. By setting this
|
|
2406
|
+
* to `false`, this element will take its default opacity throughout the animation.
|
|
2407
|
+
*/
|
|
2408
|
+
layoutCrossfade?: boolean;
|
|
2409
|
+
}
|
|
2410
|
+
type TransformTemplate = (transform: TransformProperties, generatedTransform: string) => string;
|
|
2411
|
+
interface MotionNodeAdvancedOptions {
|
|
2412
|
+
/**
|
|
2413
|
+
* Custom data to use to resolve dynamic variants differently for each animating component.
|
|
2414
|
+
*
|
|
2415
|
+
* ```jsx
|
|
2416
|
+
* const variants = {
|
|
2417
|
+
* visible: (custom) => ({
|
|
2418
|
+
* opacity: 1,
|
|
2419
|
+
* transition: { delay: custom * 0.2 }
|
|
2420
|
+
* })
|
|
2421
|
+
* }
|
|
2422
|
+
*
|
|
2423
|
+
* <motion.div custom={0} animate="visible" variants={variants} />
|
|
2424
|
+
* <motion.div custom={1} animate="visible" variants={variants} />
|
|
2425
|
+
* <motion.div custom={2} animate="visible" variants={variants} />
|
|
2426
|
+
* ```
|
|
2427
|
+
*
|
|
2428
|
+
* @public
|
|
2429
|
+
*/
|
|
2430
|
+
custom?: any;
|
|
2431
|
+
/**
|
|
2432
|
+
* @public
|
|
2433
|
+
* Set to `false` to prevent inheriting variant changes from its parent.
|
|
2434
|
+
*/
|
|
2435
|
+
inherit?: boolean;
|
|
2436
|
+
/**
|
|
2437
|
+
* @public
|
|
2438
|
+
* Set to `false` to prevent throwing an error when a `motion` component is used within a `LazyMotion` set to strict.
|
|
2439
|
+
*/
|
|
2440
|
+
ignoreStrict?: boolean;
|
|
2441
|
+
/**
|
|
2442
|
+
* Provide a set of motion values to perform animations on.
|
|
2443
|
+
*/
|
|
2444
|
+
values?: {
|
|
2445
|
+
[key: string]: MotionValue<number> | MotionValue<string>;
|
|
2446
|
+
};
|
|
2447
|
+
/**
|
|
2448
|
+
* By default, Motion generates a `transform` property with a sensible transform order. `transformTemplate`
|
|
2449
|
+
* can be used to create a different order, or to append/preprend the automatically generated `transform` property.
|
|
2450
|
+
*
|
|
2451
|
+
* ```jsx
|
|
2452
|
+
* <motion.div
|
|
2453
|
+
* style={{ x: 0, rotate: 180 }}
|
|
2454
|
+
* transformTemplate={
|
|
2455
|
+
* ({ x, rotate }) => `rotate(${rotate}deg) translateX(${x}px)`
|
|
2456
|
+
* }
|
|
2457
|
+
* />
|
|
2458
|
+
* ```
|
|
2459
|
+
*
|
|
2460
|
+
* @param transform - The latest animated transform props.
|
|
2461
|
+
* @param generatedTransform - The transform string as automatically generated by Motion
|
|
2462
|
+
*
|
|
2463
|
+
* @public
|
|
2464
|
+
*/
|
|
2465
|
+
transformTemplate?: TransformTemplate;
|
|
2466
|
+
"data-framer-appear-id"?: string;
|
|
2467
|
+
}
|
|
2468
|
+
interface MotionNodeOptions extends MotionNodeAnimationOptions, MotionNodeEventOptions, MotionNodePanHandlers, MotionNodeTapHandlers, MotionNodeHoverHandlers, MotionNodeFocusHandlers, MotionNodeViewportOptions, MotionNodeDragHandlers, MotionNodeDraggableOptions, MotionNodeLayoutOptions, MotionNodeAdvancedOptions {
|
|
2469
|
+
}
|
|
2470
|
+
|
|
1255
2471
|
declare function defaultTransformValue(name: string): number;
|
|
1256
2472
|
declare function parseValueFromTransform(transform: string | undefined, name: string): number;
|
|
1257
2473
|
declare const readTransformValue: (instance: HTMLElement, name: string) => number;
|
|
@@ -1637,6 +2853,7 @@ declare const color: {
|
|
|
1637
2853
|
test: (v: any) => boolean;
|
|
1638
2854
|
parse: (v: any) => RGBA | HSLA;
|
|
1639
2855
|
transform: (v: HSLA | RGBA | string) => string;
|
|
2856
|
+
getAnimatableNone: (v: string) => string;
|
|
1640
2857
|
};
|
|
1641
2858
|
|
|
1642
2859
|
declare function parseHex(v: string): RGBA;
|
|
@@ -1801,6 +3018,7 @@ declare const findValueType: (v: any) => ValueType | {
|
|
|
1801
3018
|
test: (v: any) => boolean;
|
|
1802
3019
|
parse: (v: any) => RGBA | HSLA;
|
|
1803
3020
|
transform: (v: string | RGBA | HSLA) => string;
|
|
3021
|
+
getAnimatableNone: (v: string) => string;
|
|
1804
3022
|
} | {
|
|
1805
3023
|
test: (v: any) => boolean;
|
|
1806
3024
|
parse: (v: string | number) => ComplexValues;
|
|
@@ -1864,4 +3082,4 @@ declare const sync: Batcher;
|
|
|
1864
3082
|
*/
|
|
1865
3083
|
declare const cancelSync: Record<string, (process: Process) => void>;
|
|
1866
3084
|
|
|
1867
|
-
export { type AcceptedAnimations, type ActiveStatsBuffer, type AnimationGeneratorType, type AnimationOptions, type
|
|
3085
|
+
export { type AcceptedAnimations, type ActiveStatsBuffer, type AnimationDefinition, type AnimationGeneratorName, type AnimationGeneratorType, type AnimationOptions, type AnimationOrchestrationOptions, type AnimationPlaybackControls, type AnimationPlaybackControlsWithThen, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, AsyncMotionValueAnimation, type Batcher, type CSSStyleDeclarationWithTransform, type CSSVariableName, type CSSVariableToken, type CancelProcess, type Color, type ComplexValueInfo, type ComplexValues, type DOMKeyframesDefinition, DOMKeyframesResolver, type DOMValueAnimationOptions, type DecayOptions, type DragElastic, type DragHandler, type DurationSpringOptions, type DynamicOption, type ElementOrSelector, type EventInfo, type EventOptions, type FrameData, type FrameStats, type GeneratorFactory, type GeneratorFactoryFunction, GroupAnimation, GroupAnimationWithThen, type GroupedAnimations, type HSLA, type InactiveStatsBuffer, type InertiaOptions, type InterpolateOptions, JSAnimation, type KeyframeGenerator, type KeyframeOptions, KeyframeResolver, type LegacyAnimationControls, type MapInputRange, type Mixer, type MixerFactory, type MotionNodeAdvancedOptions, type MotionNodeAnimationOptions, type MotionNodeDragHandlers, type MotionNodeDraggableOptions, type MotionNodeEventOptions, type MotionNodeFocusHandlers, type MotionNodeHoverHandlers, type MotionNodeLayoutOptions, type MotionNodeOptions, type MotionNodePanHandlers, type MotionNodeTapHandlers, type MotionNodeViewportOptions, MotionValue, type MotionValueEventCallbacks, type MotionValueOptions, type MultiTransformer, NativeAnimation, NativeAnimationExtended, type NativeAnimationOptions, type NativeAnimationOptionsExtended, NativeAnimationWrapper, type NumberMap, type OnHoverEndEvent, type OnHoverStartEvent, type OnKeyframesResolved, type OnPressEndEvent, type OnPressStartEvent, type Owner, type PanHandler, type PanInfo, type PassiveEffect, type PointerEventOptions, type PressGestureInfo, type Process, type ProgressTimeline, type RGBA, type RepeatType, type ResolvedConstraints, type ResolvedElastic, type ResolvedKeyframes, type ResolvedValueKeyframe, type ResolvedValues, type SVGAttributes, type SVGForcedAttrKeyframesDefinition, type SVGForcedAttrProperties, type SVGForcedAttrTransitions, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type Schedule, type SelectorCache, type SingleTransformer, 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 TapInfo, type Target, type TargetAndTransition, type TargetResolver, type TimelineWithFallback, type TransformInputRange, type TransformOptions, type TransformProperties, type TransformTemplate, type Transformer, type Transition, type UnresolvedKeyframes, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationOptionsWithRenderContext, type ValueAnimationTransition, type ValueIndexes, type ValueKeyframe, type ValueKeyframesDefinition, type ValueTransformer, type ValueTransition, type ValueType, type ValueTypeMap, type VariableKeyframesDefinition, type VariableTransitions, type Variant, type VariantLabels, type Variants, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type ViewportEventHandler, type ViewportOptions, type WithQuerySelectorAll, acceleratedValues, activeAnimations, addAttrValue, addStyleValue, alpha, analyseComplexValue, animateValue, animateView, animationMapKey, applyPxDefaults, attachSpring, attrEffect, calcGeneratorDuration, cancelFrame, cancelMicrotask, cancelSync, collectMotionValues, color, complex, convertOffsetToTimes, createGeneratorEasing, createRenderBatcher, cubicBezierAsString, defaultEasing, defaultOffset, defaultTransformValue, defaultValueTypes, degrees, dimensionValueTypes, fillOffset, fillWildcards, findDimensionValueType, findValueType, flushKeyframeResolvers, frame, frameData, frameSteps, generateLinearEasing, getAnimatableNone, getAnimationMap, getComputedStyle, getDefaultValueType, getMixer, getValueAsType, getValueTransition, getVariableValue, hex, hover, hsla, hslaToRgba, inertia, interpolate, invisibleValues, isCSSVariableName, isCSSVariableToken, isDragActive, isDragging, isGenerator, isHTMLElement, isMotionValue, isNodeOrChild, isPrimaryPointer, isSVGElement, isSVGSVGElement, isWaapiSupportedEasing, keyframes, mapEasingToNativeEasing, mapValue, maxGeneratorDuration, microtask, mix, mixArray, mixColor, mixComplex, mixImmediate, mixLinearColor, mixNumber, mixObject, mixVisibility, motionValue, number, numberValueTypes, observeTimeline, parseCSSVariable, parseValueFromTransform, percent, positionalKeys, press, progressPercentage, propEffect, px, readTransformValue, recordStats, resize, resolveElements, rgbUnit, rgba, scale, setDragLock, setStyle, spring, springValue, startWaapiAnimation, statsBuffer, styleEffect, supportedWaapiEasing, supportsBrowserAnimation, supportsFlags, supportsLinearEasing, supportsPartialKeyframes, supportsScrollTimeline, svgEffect, sync, testValueType, time, transform, transformPropOrder, transformProps, transformValue, transformValueTypes, vh, vw };
|