motion-dom 13.1.1-alpha.0 → 13.2.0

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.
Files changed (45) hide show
  1. package/dist/cjs/index.js +152 -150
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/animation/animate/effects.mjs +48 -0
  4. package/dist/es/animation/animate/effects.mjs.map +1 -0
  5. package/dist/es/animation/generators/inertia.mjs +8 -6
  6. package/dist/es/animation/generators/inertia.mjs.map +1 -1
  7. package/dist/es/animation/generators/spring.mjs +43 -58
  8. package/dist/es/animation/generators/spring.mjs.map +1 -1
  9. package/dist/es/animation/generators/utils/calc-duration.mjs +5 -4
  10. package/dist/es/animation/generators/utils/calc-duration.mjs.map +1 -1
  11. package/dist/es/animation/interfaces/visual-element-target.mjs +2 -1
  12. package/dist/es/animation/interfaces/visual-element-target.mjs.map +1 -1
  13. package/dist/es/animation/waapi/supports/waapi.mjs +3 -6
  14. package/dist/es/animation/waapi/supports/waapi.mjs.map +1 -1
  15. package/dist/es/animation/waapi/utils/accelerated-values.mjs +1 -12
  16. package/dist/es/animation/waapi/utils/accelerated-values.mjs.map +1 -1
  17. package/dist/es/effects/MotionValueState.mjs +8 -2
  18. package/dist/es/effects/MotionValueState.mjs.map +1 -1
  19. package/dist/es/effects/style/index.mjs +4 -11
  20. package/dist/es/effects/style/index.mjs.map +1 -1
  21. package/dist/es/effects/style/transform.mjs +0 -5
  22. package/dist/es/effects/style/transform.mjs.map +1 -1
  23. package/dist/es/effects/utils/create-effect.mjs +6 -3
  24. package/dist/es/effects/utils/create-effect.mjs.map +1 -1
  25. package/dist/es/index.mjs +4 -1
  26. package/dist/es/index.mjs.map +1 -1
  27. package/dist/es/projection/node/create-projection-node.mjs +8 -13
  28. package/dist/es/projection/node/create-projection-node.mjs.map +1 -1
  29. package/dist/es/projection/styles/transform.mjs +1 -3
  30. package/dist/es/projection/styles/transform.mjs.map +1 -1
  31. package/dist/es/projection/utils/has-transform.mjs +1 -7
  32. package/dist/es/projection/utils/has-transform.mjs.map +1 -1
  33. package/dist/es/render/VisualElement.mjs +2 -5
  34. package/dist/es/render/VisualElement.mjs.map +1 -1
  35. package/dist/es/render/html/utils/build-styles.mjs +12 -10
  36. package/dist/es/render/html/utils/build-styles.mjs.map +1 -1
  37. package/dist/es/render/html/utils/build-transform.mjs +0 -5
  38. package/dist/es/render/html/utils/build-transform.mjs.map +1 -1
  39. package/dist/es/value/index.mjs.map +1 -1
  40. package/dist/index.d.ts +72 -9
  41. package/dist/motion-dom.dev.js +152 -150
  42. package/dist/motion-dom.js +1 -1
  43. package/dist/size-rollup-style-effect.js +1 -1
  44. package/dist/size-rollup-style-effect.js.map +1 -1
  45. package/package.json +2 -2
@@ -736,15 +736,16 @@
736
736
  * to prevent infinite loops
737
737
  */
738
738
  const maxGeneratorDuration = 20000;
739
- function calcGeneratorDuration(generator) {
739
+ function calcGeneratorDuration(generator, timeStep = 50, maxDuration = maxGeneratorDuration, keyframes) {
740
740
  let duration = 0;
741
- const timeStep = 50;
742
741
  let state = generator.next(duration);
743
- while (!state.done && duration < maxGeneratorDuration) {
742
+ keyframes?.push(state.value);
743
+ while (!state.done && duration < maxDuration) {
744
744
  duration += timeStep;
745
745
  state = generator.next(duration);
746
+ keyframes?.push(state.value);
746
747
  }
747
- return duration >= maxGeneratorDuration ? Infinity : duration;
748
+ return duration >= maxDuration ? Infinity : duration;
748
749
  }
749
750
 
750
751
  /**
@@ -828,9 +829,13 @@
828
829
  const exponentialDecay = undampedFreq * dampingRatio;
829
830
  const delta = exponentialDecay * duration;
830
831
  const d = delta * velocity + velocity;
831
- const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
832
+ const e = dampingRatio *
833
+ dampingRatio *
834
+ undampedFreq *
835
+ undampedFreq *
836
+ duration;
832
837
  const f = Math.exp(-delta);
833
- const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
838
+ const g = calcAngularFreq(undampedFreq * undampedFreq, dampingRatio);
834
839
  const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
835
840
  return (factor * ((d - e) * f)) / g;
836
841
  };
@@ -861,7 +866,7 @@
861
866
  };
862
867
  }
863
868
  else {
864
- const stiffness = Math.pow(undampedFreq, 2) * mass;
869
+ const stiffness = undampedFreq * undampedFreq * mass;
865
870
  return {
866
871
  stiffness,
867
872
  damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
@@ -941,6 +946,7 @@
941
946
  const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
942
947
  const initialDelta = target - origin;
943
948
  const undampedAngularFreq = motionUtils.millisecondsToSeconds(Math.sqrt(stiffness / mass));
949
+ const decay = dampingRatio * undampedAngularFreq;
944
950
  /**
945
951
  * If we're working on a granular scale, use smaller defaults for determining
946
952
  * when the spring is finished.
@@ -957,35 +963,38 @@
957
963
  : springDefaults.restDelta.default);
958
964
  let resolveSpring;
959
965
  let resolveVelocity;
960
- // Underdamped coefficients, hoisted for use in the inlined next() hot path
961
- let angularFreq;
962
- let A;
963
- let sinCoeff;
964
- let cosCoeff;
965
966
  if (dampingRatio < 1) {
966
- angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
967
- A =
968
- (initialVelocity +
969
- dampingRatio * undampedAngularFreq * initialDelta) /
970
- angularFreq;
967
+ const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
968
+ const A = (initialVelocity + decay * initialDelta) / angularFreq;
969
+ // Coefficients for the analytical derivative (px/ms)
970
+ const sinCoeff = decay * A + initialDelta * angularFreq;
971
+ const cosCoeff = decay * initialDelta - A * angularFreq;
972
+ /**
973
+ * The underdamped hot path needs both position and velocity every
974
+ * frame and they share the same exp/sin/cos terms, so sample both
975
+ * at once, memoized by t, to only calculate them once per frame.
976
+ */
977
+ let sampledT = -1;
978
+ let position = 0;
979
+ let velocityAtT = 0;
980
+ const sample = (t) => {
981
+ if (t !== sampledT) {
982
+ sampledT = t;
983
+ const envelope = Math.exp(-decay * t);
984
+ const sin = Math.sin(angularFreq * t);
985
+ const cos = Math.cos(angularFreq * t);
986
+ position = target - envelope * (A * sin + initialDelta * cos);
987
+ velocityAtT = envelope * (sinCoeff * sin + cosCoeff * cos);
988
+ }
989
+ };
971
990
  // Underdamped spring
972
991
  resolveSpring = (t) => {
973
- const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
974
- return (target -
975
- envelope *
976
- (A * Math.sin(angularFreq * t) +
977
- initialDelta * Math.cos(angularFreq * t)));
992
+ sample(t);
993
+ return position;
978
994
  };
979
- // Analytical derivative of underdamped spring (px/ms)
980
- sinCoeff =
981
- dampingRatio * undampedAngularFreq * A + initialDelta * angularFreq;
982
- cosCoeff =
983
- dampingRatio * undampedAngularFreq * initialDelta - A * angularFreq;
984
995
  resolveVelocity = (t) => {
985
- const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
986
- return envelope *
987
- (sinCoeff * Math.sin(angularFreq * t) +
988
- cosCoeff * Math.cos(angularFreq * t));
996
+ sample(t);
997
+ return velocityAtT;
989
998
  };
990
999
  }
991
1000
  else if (dampingRatio === 1) {
@@ -1003,13 +1012,12 @@
1003
1012
  // Overdamped spring
1004
1013
  const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
1005
1014
  resolveSpring = (t) => {
1006
- const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
1015
+ const envelope = Math.exp(-decay * t);
1007
1016
  // When performing sinh or cosh values can hit Infinity so we cap them here
1008
1017
  const freqForT = Math.min(dampedAngularFreq * t, 300);
1009
1018
  return (target -
1010
1019
  (envelope *
1011
- ((initialVelocity +
1012
- dampingRatio * undampedAngularFreq * initialDelta) *
1020
+ ((initialVelocity + decay * initialDelta) *
1013
1021
  Math.sinh(freqForT) +
1014
1022
  dampedAngularFreq *
1015
1023
  initialDelta *
@@ -1017,43 +1025,21 @@
1017
1025
  dampedAngularFreq);
1018
1026
  };
1019
1027
  // Analytical derivative of overdamped spring (px/ms)
1020
- const P = (initialVelocity +
1021
- dampingRatio * undampedAngularFreq * initialDelta) /
1022
- dampedAngularFreq;
1023
- const sinhCoeff = dampingRatio * undampedAngularFreq * P - initialDelta * dampedAngularFreq;
1024
- const coshCoeff = dampingRatio * undampedAngularFreq * initialDelta - P * dampedAngularFreq;
1028
+ const P = (initialVelocity + decay * initialDelta) / dampedAngularFreq;
1029
+ const sinhCoeff = decay * P - initialDelta * dampedAngularFreq;
1030
+ const coshCoeff = decay * initialDelta - P * dampedAngularFreq;
1025
1031
  resolveVelocity = (t) => {
1026
- const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
1032
+ const envelope = Math.exp(-decay * t);
1027
1033
  const freqForT = Math.min(dampedAngularFreq * t, 300);
1028
- return envelope *
1034
+ return (envelope *
1029
1035
  (sinhCoeff * Math.sinh(freqForT) +
1030
- coshCoeff * Math.cosh(freqForT));
1036
+ coshCoeff * Math.cosh(freqForT)));
1031
1037
  };
1032
1038
  }
1033
1039
  const generator = {
1034
1040
  calculatedDuration: isResolvedFromDuration ? duration || null : null,
1035
1041
  velocity: (t) => motionUtils.secondsToMilliseconds(resolveVelocity(t)),
1036
1042
  next: (t) => {
1037
- /**
1038
- * For underdamped physics springs we need both position and
1039
- * velocity each tick. Compute shared trig values once to avoid
1040
- * duplicate Math.exp/sin/cos calls on the hot path.
1041
- */
1042
- if (!isResolvedFromDuration && dampingRatio < 1) {
1043
- const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
1044
- const sin = Math.sin(angularFreq * t);
1045
- const cos = Math.cos(angularFreq * t);
1046
- const current = target -
1047
- envelope *
1048
- (A * sin + initialDelta * cos);
1049
- const currentVelocity = motionUtils.secondsToMilliseconds(envelope *
1050
- (sinCoeff * sin + cosCoeff * cos));
1051
- state.done =
1052
- Math.abs(currentVelocity) <= restSpeed &&
1053
- Math.abs(target - current) <= restDelta;
1054
- state.value = state.done ? target : current;
1055
- return state;
1056
- }
1057
1043
  const current = resolveSpring(t);
1058
1044
  if (!isResolvedFromDuration) {
1059
1045
  const currentVelocity = motionUtils.secondsToMilliseconds(resolveVelocity(t));
@@ -1084,19 +1070,13 @@
1084
1070
  return options;
1085
1071
  };
1086
1072
 
1087
- const velocitySampleDuration = 5; // ms
1088
- function getGeneratorVelocity(resolveValue, t, current) {
1089
- const prevT = Math.max(t - velocitySampleDuration, 0);
1090
- return motionUtils.velocityPerSecond(current - resolveValue(prevT), t - prevT);
1091
- }
1092
-
1093
1073
  function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
1094
1074
  const origin = keyframes[0];
1095
1075
  const state = {
1096
1076
  done: false,
1097
1077
  value: origin,
1098
1078
  };
1099
- const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max);
1079
+ const isOutOfBounds = (v) => v < min || v > max;
1100
1080
  const nearestBoundary = (v) => {
1101
1081
  if (min === undefined)
1102
1082
  return max;
@@ -1114,12 +1094,10 @@
1114
1094
  if (target !== ideal)
1115
1095
  amplitude = target - origin;
1116
1096
  const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
1117
- const calcLatest = (t) => target + calcDelta(t);
1118
1097
  const applyFriction = (t) => {
1119
1098
  const delta = calcDelta(t);
1120
- const latest = calcLatest(t);
1121
1099
  state.done = Math.abs(delta) <= restDelta;
1122
- state.value = state.done ? target : latest;
1100
+ state.value = state.done ? target : target + delta;
1123
1101
  };
1124
1102
  /**
1125
1103
  * Ideally this would resolve for t in a stateless way, we could
@@ -1135,7 +1113,12 @@
1135
1113
  timeReachedBoundary = t;
1136
1114
  spring$1 = spring({
1137
1115
  keyframes: [state.value, nearestBoundary(state.value)],
1138
- velocity: getGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000
1116
+ /**
1117
+ * The friction curve is target + calcDelta(t), so its exact
1118
+ * derivative is -calcDelta(t) / timeConstant in units/ms,
1119
+ * converted here to the units/second expected by spring.
1120
+ */
1121
+ velocity: (-calcDelta(t) / timeConstant) * 1000,
1139
1122
  damping: bounceDamping,
1140
1123
  stiffness: bounceStiffness,
1141
1124
  restDelta,
@@ -1304,6 +1287,12 @@
1304
1287
  };
1305
1288
  }
1306
1289
 
1290
+ const velocitySampleDuration = 5; // ms
1291
+ function getGeneratorVelocity(resolveValue, t, current) {
1292
+ const prevT = Math.max(t - velocitySampleDuration, 0);
1293
+ return motionUtils.velocityPerSecond(current - resolveValue(prevT), t - prevT);
1294
+ }
1295
+
1307
1296
  const isNotNull = (value) => value !== null;
1308
1297
  function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe, speed = 1) {
1309
1298
  const resolvedKeyframes = keyframes.filter(isNotNull);
@@ -2479,15 +2468,6 @@
2479
2468
  "transform",
2480
2469
  "backgroundColor",
2481
2470
  ]);
2482
- function hasIndependentTransform(values) {
2483
- if (!values)
2484
- return false;
2485
- for (const key in values) {
2486
- if (transformProps.has(key))
2487
- return true;
2488
- }
2489
- return false;
2490
- }
2491
2471
 
2492
2472
  const browserColorFunctions = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
2493
2473
  function hasBrowserOnlyColors(keyframes) {
@@ -2527,8 +2507,7 @@
2527
2507
  !(subject instanceof SVGElement)) {
2528
2508
  return false;
2529
2509
  }
2530
- const owner = motionValue.owner;
2531
- const { onUpdate, transformTemplate } = owner.getProps();
2510
+ const { onUpdate, transformTemplate } = motionValue.owner.getProps();
2532
2511
  return (supportsWaapi() &&
2533
2512
  name &&
2534
2513
  /**
@@ -2538,9 +2517,7 @@
2538
2517
  (acceleratedValues.has(name) ||
2539
2518
  (colorProperties.has(name) &&
2540
2519
  hasBrowserOnlyColors(keyframes))) &&
2541
- (name !== "transform" ||
2542
- (!transformTemplate &&
2543
- !hasIndependentTransform(owner.latestValues))) &&
2520
+ (name !== "transform" || !transformTemplate) &&
2544
2521
  /**
2545
2522
  * If we're outputting values to onUpdate then we can't use WAAPI as there's
2546
2523
  * no way to read the value from WAAPI every frame.
@@ -3687,6 +3664,7 @@
3687
3664
  return visualElement.props[optimizedAppearDataAttribute];
3688
3665
  }
3689
3666
 
3667
+ const isBrowser$1 = typeof window !== "undefined";
3690
3668
  /**
3691
3669
  * Decide whether we should block this animation. Previously, we achieved this
3692
3670
  * just by checking whether the key was listed in protectedKeys, but this
@@ -3750,7 +3728,7 @@
3750
3728
  * to see if we're handling off from an existing animation.
3751
3729
  */
3752
3730
  let isHandoff = false;
3753
- if (window.MotionHandoffAnimation) {
3731
+ if (isBrowser$1 && window.MotionHandoffAnimation) {
3754
3732
  const appearId = getOptimisedAppearId(visualElement);
3755
3733
  if (appearId) {
3756
3734
  const startTime = window.MotionHandoffAnimation(appearId, key, frame);
@@ -4320,6 +4298,47 @@
4320
4298
  return true;
4321
4299
  });
4322
4300
 
4301
+ /**
4302
+ * Effects registered via `animate.addEffect()`, most recent first.
4303
+ */
4304
+ const effects = [];
4305
+ function addEffect(effect) {
4306
+ motionUtils.invariant(typeof effect.test === "function" && typeof effect.read === "function", "Effects passed to animate.addEffect() need test() and read().", "effect-missing-test");
4307
+ removeEffect(effect);
4308
+ effects.unshift(effect);
4309
+ }
4310
+ function removeEffect(effect) {
4311
+ motionUtils.removeItem(effects, effect);
4312
+ }
4313
+ function findEffect(subject) {
4314
+ return effects.find((effect) => effect.test(subject));
4315
+ }
4316
+ /**
4317
+ * Animate the keys of `subject` via `effect`. Motion values are created on
4318
+ * first animation, seeded from `effect.read()` or the first keyframe, and
4319
+ * then bound to the subject via the effect for the rest of its life.
4320
+ */
4321
+ function animateEffectSubject(effect, subject, keyframes, transition = {}) {
4322
+ const animations = [];
4323
+ for (const key in keyframes) {
4324
+ const target = keyframes[key];
4325
+ let value = effect.get(subject, key);
4326
+ if (!value) {
4327
+ const initial = effect.read(subject, key, target) ?? firstKeyframe(target);
4328
+ motionUtils.invariant(initial !== undefined, `"${key}" can't be read from the animated subject. Provide [from, to] keyframes.`, "effect-unreadable-value");
4329
+ value = motionValue(initial);
4330
+ effect(subject, { [key]: value });
4331
+ }
4332
+ value.start(animateMotionValue(key, value, target, getValueTransition(transition, key)));
4333
+ value.animation && animations.push(value.animation);
4334
+ }
4335
+ return animations;
4336
+ }
4337
+ function firstKeyframe(target) {
4338
+ const first = Array.isArray(target) ? target[0] : undefined;
4339
+ return first === null ? undefined : first;
4340
+ }
4341
+
4323
4342
  function resolveElements(elementOrSelector, scope, selectorCache) {
4324
4343
  if (elementOrSelector == null) {
4325
4344
  return [];
@@ -4364,7 +4383,13 @@
4364
4383
  };
4365
4384
 
4366
4385
  class MotionValueState {
4367
- constructor() {
4386
+ /**
4387
+ * @param step - The frameloop step renders are scheduled in. Defaults
4388
+ * to `frame.render`. Effects that feed a render loop running in
4389
+ * `frame.render` (GPU scenes) should write in `frame.preRender`.
4390
+ */
4391
+ constructor(step = frame.render) {
4392
+ this.step = step;
4368
4393
  this.latest = {};
4369
4394
  this.values = new Map();
4370
4395
  }
@@ -4381,7 +4406,7 @@
4381
4406
  else {
4382
4407
  this.latest[name] = v;
4383
4408
  }
4384
- render && frame.render(render);
4409
+ render && this.step(render);
4385
4410
  };
4386
4411
  onChange();
4387
4412
  const cancelOnChange = value.on("change", onChange);
@@ -4400,10 +4425,10 @@
4400
4425
  }
4401
4426
  }
4402
4427
 
4403
- function createEffect(addValue) {
4428
+ function createEffect(addValue, { step, ...options } = {}) {
4404
4429
  const stateCache = new WeakMap();
4405
- return (subject, values) => {
4406
- const state = stateCache.get(subject) ?? new MotionValueState();
4430
+ const effect = (subject, values) => {
4431
+ const state = stateCache.get(subject) ?? new MotionValueState(step);
4407
4432
  stateCache.set(subject, state);
4408
4433
  const subscriptions = [];
4409
4434
  for (const key in values) {
@@ -4416,6 +4441,9 @@
4416
4441
  cancel();
4417
4442
  };
4418
4443
  };
4444
+ return Object.assign(effect, options, {
4445
+ get: (subject, key) => stateCache.get(subject)?.get(key),
4446
+ });
4419
4447
  }
4420
4448
 
4421
4449
  function canSetAsProperty(element, name) {
@@ -4511,37 +4539,25 @@
4511
4539
  ? `${pathRotation}deg`
4512
4540
  : pathRotation}) `;
4513
4541
  }
4514
- const userTransform = state.latest.transform;
4515
- if (userTransform && userTransform !== "none") {
4516
- transformIsDefault = false;
4517
- transform += userTransform;
4518
- }
4519
4542
  return transformIsDefault ? "none" : transform.trim();
4520
4543
  }
4521
4544
 
4522
4545
  const originProps = new Set(["originX", "originY", "originZ"]);
4523
- /**
4524
- * Internal key for the computed transform channel. The user "transform"
4525
- * value now composes into this channel, so it can't share the "transform"
4526
- * key. Prefixed with $ so it can never collide with a real style key
4527
- * (like "transformStyle", which is the transform-style CSS property).
4528
- */
4529
- const computedTransform = "$transform";
4530
4546
  const addStyleValue = (element, state, key, value) => {
4531
4547
  let render = undefined;
4532
4548
  let computed = undefined;
4533
- if (transformProps.has(key) || key === "transform") {
4534
- if (!state.get(computedTransform)) {
4549
+ if (transformProps.has(key)) {
4550
+ if (!state.get("transform")) {
4535
4551
  // If this is an HTML element, we need to set the transform-box to fill-box
4536
4552
  // to normalise the transform relative to the element's bounding box
4537
4553
  if (!isHTMLElement(element) && !state.get("transformBox")) {
4538
4554
  addStyleValue(element, state, "transformBox", new MotionValue("fill-box"));
4539
4555
  }
4540
- state.set(computedTransform, new MotionValue("none"), () => {
4556
+ state.set("transform", new MotionValue("none"), () => {
4541
4557
  element.style.transform = buildTransform$1(state);
4542
4558
  });
4543
4559
  }
4544
- computed = state.get(computedTransform);
4560
+ computed = state.get("transform");
4545
4561
  }
4546
4562
  else if (originProps.has(key)) {
4547
4563
  if (!state.get("transformOrigin")) {
@@ -6816,10 +6832,7 @@
6816
6832
  }
6817
6833
  if (value.accelerate &&
6818
6834
  acceleratedValues.has(key) &&
6819
- this.current instanceof HTMLElement &&
6820
- (key !== "transform" ||
6821
- (!this.props.transformTemplate &&
6822
- !hasIndependentTransform(this.latestValues)))) {
6835
+ this.current instanceof HTMLElement) {
6823
6836
  const { factory, keyframes, times, ease, duration } = value.accelerate;
6824
6837
  const animation = new NativeAnimation({
6825
6838
  element: this.current,
@@ -7214,12 +7227,6 @@
7214
7227
  values.skewX ||
7215
7228
  values.skewY);
7216
7229
  }
7217
- function hasVisualTransform(values) {
7218
- return (hasTransform(values) ||
7219
- (values.transform &&
7220
- values.transform !== "none" &&
7221
- values.transform !== ""));
7222
- }
7223
7230
  function has2DTranslate(values) {
7224
7231
  return is2DTranslate(values.x) || is2DTranslate(values.y);
7225
7232
  }
@@ -7414,11 +7421,6 @@
7414
7421
  transformIsDefault = false;
7415
7422
  transformString += `rotate(${getValueAsType(pathRotation, numberValueTypes.pathRotation)}) `;
7416
7423
  }
7417
- const userTransform = latestValues.transform;
7418
- if (userTransform && userTransform !== "none") {
7419
- transformIsDefault = false;
7420
- transformString += userTransform;
7421
- }
7422
7424
  transformString = transformString.trim();
7423
7425
  // If we have a custom `transform` template, pass our transform values and
7424
7426
  // generated transformString to that before returning
@@ -7444,7 +7446,7 @@
7444
7446
  */
7445
7447
  for (const key in latestValues) {
7446
7448
  const value = latestValues[key];
7447
- if (transformProps.has(key) || key === "transform") {
7449
+ if (transformProps.has(key)) {
7448
7450
  // If this is a transform, flag to enable further transform processing
7449
7451
  hasTransform = true;
7450
7452
  continue;
@@ -7467,15 +7469,17 @@
7467
7469
  }
7468
7470
  }
7469
7471
  }
7470
- if (hasTransform || transformTemplate) {
7471
- style.transform = buildTransform(latestValues, state.transform, transformTemplate);
7472
- }
7473
- else if (style.transform) {
7474
- /**
7475
- * If we have previously created a transform but currently don't have any,
7476
- * reset transform style to none.
7477
- */
7478
- style.transform = "none";
7472
+ if (!latestValues.transform) {
7473
+ if (hasTransform || transformTemplate) {
7474
+ style.transform = buildTransform(latestValues, state.transform, transformTemplate);
7475
+ }
7476
+ else if (style.transform) {
7477
+ /**
7478
+ * If we have previously created a transform but currently don't have any,
7479
+ * reset transform style to none.
7480
+ */
7481
+ style.transform = "none";
7482
+ }
7479
7483
  }
7480
7484
  /**
7481
7485
  * Build a transformOrigin style. Uses the same defaults as the browser for
@@ -8480,7 +8484,7 @@
8480
8484
  transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
8481
8485
  }
8482
8486
  if (latestTransform) {
8483
- const { transformPerspective, rotate, pathRotation, rotateX, rotateY, skewX, skewY, transform: userTransform, } = latestTransform;
8487
+ const { transformPerspective, rotate, pathRotation, rotateX, rotateY, skewX, skewY, } = latestTransform;
8484
8488
  if (transformPerspective)
8485
8489
  transform = `perspective(${transformPerspective}px) ${transform}`;
8486
8490
  if (rotate)
@@ -8496,8 +8500,6 @@
8496
8500
  transform += `skewX(${skewX}deg) `;
8497
8501
  if (skewY)
8498
8502
  transform += `skewY(${skewY}deg) `;
8499
- if (userTransform && userTransform !== "none")
8500
- transform += `${userTransform} `;
8501
8503
  }
8502
8504
  /**
8503
8505
  * Apply scale to match the size of the element to the size we want it.
@@ -8741,14 +8743,14 @@
8741
8743
  */
8742
8744
  const animationTarget = 1000;
8743
8745
  let id = 0;
8744
- function resetDistortingTransform(key, visualElement, values, sharedAnimationValues, resetValue = 0) {
8746
+ function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
8745
8747
  const { latestValues } = visualElement;
8746
- // Record the distorting transform and then temporarily reset it
8748
+ // Record the distorting transform and then temporarily set it to 0
8747
8749
  if (latestValues[key]) {
8748
8750
  values[key] = latestValues[key];
8749
- visualElement.setStaticValue(key, resetValue);
8751
+ visualElement.setStaticValue(key, 0);
8750
8752
  if (sharedAnimationValues) {
8751
- sharedAnimationValues[key] = resetValue;
8753
+ sharedAnimationValues[key] = 0;
8752
8754
  }
8753
8755
  }
8754
8756
  }
@@ -9327,7 +9329,7 @@
9327
9329
  if (isResetRequested &&
9328
9330
  this.instance &&
9329
9331
  (hasProjection ||
9330
- hasVisualTransform(this.latestValues) ||
9332
+ hasTransform(this.latestValues) ||
9331
9333
  transformTemplateHasChanged)) {
9332
9334
  resetTransform(this.instance, transformTemplateValue);
9333
9335
  this.shouldResetTransform = false;
@@ -9995,8 +9997,7 @@
9995
9997
  latestValues.rotateY ||
9996
9998
  latestValues.rotateZ ||
9997
9999
  latestValues.skewX ||
9998
- latestValues.skewY ||
9999
- (latestValues.transform && latestValues.transform !== "none")) {
10000
+ latestValues.skewY) {
10000
10001
  hasDistortingTransform = true;
10001
10002
  }
10002
10003
  // If there's no distorting values, we don't need to do any more.
@@ -10006,9 +10007,6 @@
10006
10007
  if (latestValues.z) {
10007
10008
  resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
10008
10009
  }
10009
- if (latestValues.transform && latestValues.transform !== "none") {
10010
- resetDistortingTransform("transform", visualElement, resetValues, this.animationValues, "none");
10011
- }
10012
10010
  // Check the skew and rotate value of all axes and reset to 0
10013
10011
  for (let i = 0; i < transformAxes.length; i++) {
10014
10012
  resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
@@ -10058,8 +10056,7 @@
10058
10056
  targetStyle.pointerEvents =
10059
10057
  resolveMotionValue(styleProp?.pointerEvents) || "";
10060
10058
  }
10061
- if (this.hasProjected &&
10062
- !hasVisualTransform(this.latestValues)) {
10059
+ if (this.hasProjected && !hasTransform(this.latestValues)) {
10063
10060
  targetStyle.transform = transformTemplate
10064
10061
  ? transformTemplate({}, "")
10065
10062
  : "none";
@@ -10824,6 +10821,7 @@
10824
10821
  exports.KeyframeResolver = KeyframeResolver;
10825
10822
  exports.LayoutAnimationBuilder = LayoutAnimationBuilder;
10826
10823
  exports.MotionValue = MotionValue;
10824
+ exports.MotionValueState = MotionValueState;
10827
10825
  exports.NativeAnimation = NativeAnimation;
10828
10826
  exports.NativeAnimationExtended = NativeAnimationExtended;
10829
10827
  exports.NativeAnimationWrapper = NativeAnimationWrapper;
@@ -10835,11 +10833,13 @@
10835
10833
  exports.acceleratedValues = acceleratedValues;
10836
10834
  exports.addAttrValue = addAttrValue;
10837
10835
  exports.addDomEvent = addDomEvent;
10836
+ exports.addEffect = addEffect;
10838
10837
  exports.addScaleCorrector = addScaleCorrector;
10839
10838
  exports.addStyleValue = addStyleValue;
10840
10839
  exports.addValueToWillChange = addValueToWillChange;
10841
10840
  exports.alpha = alpha;
10842
10841
  exports.analyseComplexValue = analyseComplexValue;
10842
+ exports.animateEffectSubject = animateEffectSubject;
10843
10843
  exports.animateMotionValue = animateMotionValue;
10844
10844
  exports.animateSingleValue = animateSingleValue;
10845
10845
  exports.animateTarget = animateTarget;
@@ -10903,6 +10903,7 @@
10903
10903
  exports.createAxisDelta = createAxisDelta;
10904
10904
  exports.createBox = createBox;
10905
10905
  exports.createDelta = createDelta;
10906
+ exports.createEffect = createEffect;
10906
10907
  exports.createGeneratorEasing = createGeneratorEasing;
10907
10908
  exports.createProjectionNode = createProjectionNode;
10908
10909
  exports.createRenderBatcher = createRenderBatcher;
@@ -10919,6 +10920,7 @@
10919
10920
  exports.fillOffset = fillOffset;
10920
10921
  exports.fillWildcards = fillWildcards;
10921
10922
  exports.findDimensionValueType = findDimensionValueType;
10923
+ exports.findEffect = findEffect;
10922
10924
  exports.findValueType = findValueType;
10923
10925
  exports.flushKeyframeResolvers = flushKeyframeResolvers;
10924
10926
  exports.followValue = followValue;
@@ -10944,7 +10946,6 @@
10944
10946
  exports.getViewAnimations = getViewAnimations;
10945
10947
  exports.globalProjectionState = globalProjectionState;
10946
10948
  exports.has2DTranslate = has2DTranslate;
10947
- exports.hasIndependentTransform = hasIndependentTransform;
10948
10949
  exports.hasReducedMotionListener = hasReducedMotionListener;
10949
10950
  exports.hasScale = hasScale;
10950
10951
  exports.hasTransform = hasTransform;
@@ -11023,6 +11024,7 @@
11023
11024
  exports.removeAxisDelta = removeAxisDelta;
11024
11025
  exports.removeAxisTransforms = removeAxisTransforms;
11025
11026
  exports.removeBoxTransforms = removeBoxTransforms;
11027
+ exports.removeEffect = removeEffect;
11026
11028
  exports.removePointDelta = removePointDelta;
11027
11029
  exports.renderHTML = renderHTML;
11028
11030
  exports.renderSVG = renderSVG;