framer-motion 6.2.3 → 6.2.4

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/cjs/index.js CHANGED
@@ -1897,9 +1897,6 @@ function createProjectionNode(_a) {
1897
1897
  };
1898
1898
  this.hasProjected = false;
1899
1899
  this.isVisible = true;
1900
- /**
1901
- * Animation
1902
- */
1903
1900
  this.animationProgress = 0;
1904
1901
  /**
1905
1902
  * Shared layout
@@ -2024,6 +2021,15 @@ function createProjectionNode(_a) {
2024
2021
  _this.startAnimation(animationOptions);
2025
2022
  }
2026
2023
  else {
2024
+ /**
2025
+ * If the layout hasn't changed and we have an animation that hasn't started yet,
2026
+ * finish it immediately. Otherwise it will be animating from a location
2027
+ * that was probably never commited to screen and look like a jumpy box.
2028
+ */
2029
+ if (!hasLayoutChanged &&
2030
+ _this.animationProgress === 0) {
2031
+ _this.finishAnimation();
2032
+ }
2027
2033
  _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));
2028
2034
  }
2029
2035
  _this.targetLayout = newLayout;
@@ -2513,6 +2519,7 @@ function createProjectionNode(_a) {
2513
2519
  !isOnlyMember &&
2514
2520
  this.options.crossfade === true &&
2515
2521
  !this.path.some(hasOpacityCrossfade));
2522
+ this.animationProgress = 0;
2516
2523
  this.mixTargetDelta = function (latest) {
2517
2524
  var _a;
2518
2525
  var progress = latest / 1000;
@@ -2532,6 +2539,7 @@ function createProjectionNode(_a) {
2532
2539
  }
2533
2540
  _this.root.scheduleUpdateProjection();
2534
2541
  _this.scheduleRender();
2542
+ _this.animationProgress = progress;
2535
2543
  };
2536
2544
  this.mixTargetDelta(0);
2537
2545
  };
@@ -125,9 +125,6 @@ function createProjectionNode(_a) {
125
125
  };
126
126
  this.hasProjected = false;
127
127
  this.isVisible = true;
128
- /**
129
- * Animation
130
- */
131
128
  this.animationProgress = 0;
132
129
  /**
133
130
  * Shared layout
@@ -252,6 +249,15 @@ function createProjectionNode(_a) {
252
249
  _this.startAnimation(animationOptions);
253
250
  }
254
251
  else {
252
+ /**
253
+ * If the layout hasn't changed and we have an animation that hasn't started yet,
254
+ * finish it immediately. Otherwise it will be animating from a location
255
+ * that was probably never commited to screen and look like a jumpy box.
256
+ */
257
+ if (!hasLayoutChanged &&
258
+ _this.animationProgress === 0) {
259
+ _this.finishAnimation();
260
+ }
255
261
  _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));
256
262
  }
257
263
  _this.targetLayout = newLayout;
@@ -741,6 +747,7 @@ function createProjectionNode(_a) {
741
747
  !isOnlyMember &&
742
748
  this.options.crossfade === true &&
743
749
  !this.path.some(hasOpacityCrossfade));
750
+ this.animationProgress = 0;
744
751
  this.mixTargetDelta = function (latest) {
745
752
  var _a;
746
753
  var progress = latest / 1000;
@@ -760,6 +767,7 @@ function createProjectionNode(_a) {
760
767
  }
761
768
  _this.root.scheduleUpdateProjection();
762
769
  _this.scheduleRender();
770
+ _this.animationProgress = progress;
763
771
  };
764
772
  this.mixTargetDelta(0);
765
773
  };
@@ -3130,9 +3130,6 @@
3130
3130
  };
3131
3131
  this.hasProjected = false;
3132
3132
  this.isVisible = true;
3133
- /**
3134
- * Animation
3135
- */
3136
3133
  this.animationProgress = 0;
3137
3134
  /**
3138
3135
  * Shared layout
@@ -3257,6 +3254,15 @@
3257
3254
  _this.startAnimation(animationOptions);
3258
3255
  }
3259
3256
  else {
3257
+ /**
3258
+ * If the layout hasn't changed and we have an animation that hasn't started yet,
3259
+ * finish it immediately. Otherwise it will be animating from a location
3260
+ * that was probably never commited to screen and look like a jumpy box.
3261
+ */
3262
+ if (!hasLayoutChanged &&
3263
+ _this.animationProgress === 0) {
3264
+ _this.finishAnimation();
3265
+ }
3260
3266
  _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));
3261
3267
  }
3262
3268
  _this.targetLayout = newLayout;
@@ -3746,6 +3752,7 @@
3746
3752
  !isOnlyMember &&
3747
3753
  this.options.crossfade === true &&
3748
3754
  !this.path.some(hasOpacityCrossfade));
3755
+ this.animationProgress = 0;
3749
3756
  this.mixTargetDelta = function (latest) {
3750
3757
  var _a;
3751
3758
  var progress = latest / 1000;
@@ -3765,6 +3772,7 @@
3765
3772
  }
3766
3773
  _this.root.scheduleUpdateProjection();
3767
3774
  _this.scheduleRender();
3775
+ _this.animationProgress = progress;
3768
3776
  };
3769
3777
  this.mixTargetDelta(0);
3770
3778
  };